Completed
Pull Request — develop (#1726)
by
unknown
19:16
created
vendor/psr/log/Psr/Log/Test/DummyTest.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@
 block discarded – undo
17 17
  */
18 18
 class DummyTest
19 19
 {
20
-    public function __toString()
21
-    {
22
-        return 'DummyTest';
23
-    }
20
+	public function __toString()
21
+	{
22
+		return 'DummyTest';
23
+	}
24 24
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,10 +15,8 @@
 block discarded – undo
15 15
  *
16 16
  * @internal
17 17
  */
18
-class DummyTest
19
-{
20
-    public function __toString()
21
-    {
18
+class DummyTest {
19
+    public function __toString() {
22 20
         return 'DummyTest';
23 21
     }
24 22
 }
Please login to merge, or discard this patch.
vendor/psr/log/Psr/Log/LogLevel.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@
 block discarded – undo
13 13
  */
14 14
 class LogLevel
15 15
 {
16
-    const EMERGENCY = 'emergency';
17
-    const ALERT     = 'alert';
18
-    const CRITICAL  = 'critical';
19
-    const ERROR     = 'error';
20
-    const WARNING   = 'warning';
21
-    const NOTICE    = 'notice';
22
-    const INFO      = 'info';
23
-    const DEBUG     = 'debug';
16
+	const EMERGENCY = 'emergency';
17
+	const ALERT     = 'alert';
18
+	const CRITICAL  = 'critical';
19
+	const ERROR     = 'error';
20
+	const WARNING   = 'warning';
21
+	const NOTICE    = 'notice';
22
+	const INFO      = 'info';
23
+	const DEBUG     = 'debug';
24 24
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@
 block discarded – undo
11 11
 /**
12 12
  * Describes log levels.
13 13
  */
14
-class LogLevel
15
-{
14
+class LogLevel {
16 15
     const EMERGENCY = 'emergency';
17 16
     const ALERT     = 'alert';
18 17
     const CRITICAL  = 'critical';
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/Client.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 namespace GravityView\TrustedLogin;
25 25
 
26 26
 // Exit if accessed directly
27
-if ( ! defined('ABSPATH') ) {
27
+if ( ! defined( 'ABSPATH' ) ) {
28 28
 	exit;
29 29
 }
30 30
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		$ns = $config->ns();
160 160
 
161 161
 		// Namespace isn't set; allow Config
162
-		if( empty( $ns ) ) {
162
+		if ( empty( $ns ) ) {
163 163
 			return true;
164 164
 		}
165 165
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 			return $created;
344 344
 		}
345 345
 
346
-		$return_data['timing']['remote'] = timer_stop( 0, 5 );
346
+		$return_data[ 'timing' ][ 'remote' ] = timer_stop( 0, 5 );
347 347
 
348 348
 		do_action( 'trustedlogin/' . $this->config->ns() . '/access/created', array(
349 349
 			'url'    => get_site_url(),
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 			return $updated;
448 448
 		}
449 449
 
450
-		$return_data['timing']['remote'] = timer_stop( 0, 5 );
450
+		$return_data[ 'timing' ][ 'remote' ] = timer_stop( 0, 5 );
451 451
 
452 452
 		do_action( 'trustedlogin/' . $this->config->ns() . '/access/extended', array(
453 453
 			'url'    => get_site_url(),
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 		$reference_id = self::get_reference_id();
544 544
 
545 545
 		if ( $reference_id ) {
546
-			$metadata['reference_id'] = $reference_id;
546
+			$metadata[ 'reference_id' ] = $reference_id;
547 547
 		}
548 548
 
549 549
 		return $metadata;
@@ -558,12 +558,12 @@  discard block
 block discarded – undo
558 558
 	 */
559 559
 	public static function get_reference_id() {
560 560
 
561
-		if ( isset( $_REQUEST['reference_id'] ) ) {
562
-			return esc_html( $_REQUEST['reference_id'] );
561
+		if ( isset( $_REQUEST[ 'reference_id' ] ) ) {
562
+			return esc_html( $_REQUEST[ 'reference_id' ] );
563 563
 		}
564 564
 
565
-		if ( isset( $_REQUEST['ref'] ) ) {
566
-			return esc_html( $_REQUEST['ref'] );
565
+		if ( isset( $_REQUEST[ 'ref' ] ) ) {
566
+			return esc_html( $_REQUEST[ 'ref' ] );
567 567
 		}
568 568
 
569 569
 		return null;
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/SupportRole.php 2 patches
Spacing   +9 added lines, -9 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
 
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
 		// TODO: Support multiple roles
73 73
 		$role = is_array( $roles ) ? array_key_first( $roles ) : $roles;
74 74
 
75
-		return (string) $role;
75
+		return (string)$role;
76 76
 	}
77 77
 
78 78
 	/**
79 79
 	 * @return string
80 80
 	 */
81 81
 	public function get_name() {
82
-		return (string) $this->role_name;
82
+		return (string)$this->role_name;
83 83
 	}
84 84
 
85 85
 	/**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
 		$add_caps = $this->config->get_setting( 'caps/add' );
152 152
 
153
-		foreach ( (array) $add_caps as $add_cap => $reason ) {
153
+		foreach ( (array)$add_caps as $add_cap => $reason ) {
154 154
 			$capabilities[ $add_cap ] = true;
155 155
 		}
156 156
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
 		$new_role = add_role( $new_role_slug, $role_display_name, $capabilities );
168 168
 
169
-		if ( ! $new_role ){
169
+		if ( ! $new_role ) {
170 170
 
171 171
 			return new WP_Error(
172 172
 				'add_role_failed',
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 
182 182
 		$remove_caps = $this->config->get_setting( 'caps/remove' );
183 183
 
184
-		if ( ! empty( $remove_caps ) ){
184
+		if ( ! empty( $remove_caps ) ) {
185 185
 
186
-			foreach ( $remove_caps as $remove_cap => $description ){
186
+			foreach ( $remove_caps as $remove_cap => $description ) {
187 187
 				$new_role->remove_cap( $remove_cap );
188
-				$this->logging->log( 'Capability '. $remove_cap .' removed from role.', __METHOD__, 'info' );
188
+				$this->logging->log( 'Capability ' . $remove_cap . ' removed from role.', __METHOD__, 'info' );
189 189
 			}
190 190
 		}
191 191
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		// Returns void; no way to tell if successful
205 205
 		remove_role( $this->get_name() );
206 206
 
207
-		if( get_role( $this->get_name() ) ) {
207
+		if ( get_role( $this->get_name() ) ) {
208 208
 
209 209
 			$this->logging->log( "Role " . $this->get_name() . " was not removed successfully.", __METHOD__, 'error' );
210 210
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
 		$new_role = add_role( $new_role_slug, $role_display_name, $capabilities );
168 168
 
169
-		if ( ! $new_role ){
169
+		if ( ! $new_role ) {
170 170
 
171 171
 			return new WP_Error(
172 172
 				'add_role_failed',
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 
182 182
 		$remove_caps = $this->config->get_setting( 'caps/remove' );
183 183
 
184
-		if ( ! empty( $remove_caps ) ){
184
+		if ( ! empty( $remove_caps ) ) {
185 185
 
186
-			foreach ( $remove_caps as $remove_cap => $description ){
186
+			foreach ( $remove_caps as $remove_cap => $description ) {
187 187
 				$new_role->remove_cap( $remove_cap );
188 188
 				$this->logging->log( 'Capability '. $remove_cap .' removed from role.', __METHOD__, 'info' );
189 189
 			}
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/Admin.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1130,7 +1130,7 @@
 block discarded – undo
1130 1130
 		<button id="tl-%1\$s-copy" class="tl-%1\$s-auth__accesskey_copy button" aria-live="off" title="%7\$s"><span class="screen-reader-text">%5\$s</span></button>
1131 1131
 	</div>
1132 1132
 </%6\$s>
1133
-EOD;
1133
+eod;
1134 1134
 
1135 1135
 
1136 1136
 		$access_key_output = sprintf(
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 		$registered = array();
126 126
 
127
-		$registered['trustedlogin-js'] = wp_register_script(
127
+		$registered[ 'trustedlogin-js' ] = wp_register_script(
128 128
 			'trustedlogin-' . $this->config->ns(),
129 129
 			$this->config->get_setting( 'paths/js' ),
130 130
 			array( 'jquery', 'wp-a11y' ),
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			true
133 133
 		);
134 134
 
135
-		$registered['trustedlogin-css'] = wp_register_style(
135
+		$registered[ 'trustedlogin-css' ] = wp_register_style(
136 136
 			'trustedlogin-' . $this->config->ns(),
137 137
 			$this->config->get_setting( 'paths/css' ),
138 138
 			array(),
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 * @return bool
226 226
 	 */
227 227
 	private function is_login_screen() {
228
-		return did_action( 'login_init' ) && isset( $_GET['ns'] ) && $_GET['ns'] === $this->config->ns();
228
+		return did_action( 'login_init' ) && isset( $_GET[ 'ns' ] ) && $_GET[ 'ns' ] === $this->config->ns();
229 229
 	}
230 230
 
231 231
 	/**
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 		// Once logged-in, take user back to auth request screen.
243 243
 		if ( ! is_user_logged_in() ) {
244
-			$_REQUEST['redirect_to'] = site_url( add_query_arg( array() ) );
244
+			$_REQUEST[ 'redirect_to' ] = site_url( add_query_arg( array() ) );
245 245
 			return;
246 246
 		}
247 247
 
@@ -259,19 +259,19 @@  discard block
 block discarded – undo
259 259
 		$interim_login = true;
260 260
 
261 261
 		// The login_headertitle filter was deprecated in WP 5.2.0 for login_headertext
262
-		if( version_compare( $wp_version, '5.2.0', '<' ) ) {
262
+		if ( version_compare( $wp_version, '5.2.0', '<' ) ) {
263 263
 			add_filter( 'login_headertitle', '__return_empty_string' );
264 264
 		} else {
265 265
 			add_filter( 'login_headertext', '__return_empty_string' );
266 266
 		}
267 267
 
268
-		add_filter( 'login_headerurl', function () {
268
+		add_filter( 'login_headerurl', function() {
269 269
 			return $this->config->get_setting( 'vendor/website' );
270 270
 		});
271 271
 
272 272
 		login_header();
273 273
 
274
-		wp_enqueue_style( 'common');
274
+		wp_enqueue_style( 'common' );
275 275
 
276 276
 		wp_add_inline_style( 'common', $this->get_login_inline_css() );
277 277
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	margin-top: 36px;
302 302
 }
303 303
 .login h1 a {
304
-	background-image: url("' . $this->config->get_setting( 'vendor/logo_url' ). '")!important;
304
+	background-image: url("' . $this->config->get_setting( 'vendor/logo_url' ) . '")!important;
305 305
 	background-size: contain!important;
306 306
 }
307 307
 ';
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 			return '';
326 326
 		}
327 327
 
328
-		$support_user = $support_users[0];
328
+		$support_user = $support_users[ 0 ];
329 329
 
330 330
 		$_user_creator_id = get_user_option( $this->support_user->created_by_meta_key, $support_user->ID );
331 331
 		$_user_creator    = $_user_creator_id ? get_user_by( 'id', $_user_creator_id ) : false;
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 			return '';
451 451
 		}
452 452
 
453
-		$template =  '<div class="tl-{{ns}}-auth__ref"><p><span class="tl-{{ns}}-auth_ref__id">{{reference_text}}</span></p></div>';
453
+		$template = '<div class="tl-{{ns}}-auth__ref"><p><span class="tl-{{ns}}-auth_ref__id">{{reference_text}}</span></p></div>';
454 454
 
455 455
 		$content = array(
456 456
 			'reference_text' => sprintf( esc_html__( 'Reference #%s', 'gravityview' ), $reference_id ),
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 		if ( $has_access ) {
469 469
 			foreach ( $has_access as $access ) {
470 470
 				// translators: %1$s is replaced with the name of the software developer (e.g. "Acme Widgets"). %2$s is the amount of time remaining for access ("1 week")
471
-				$intro = sprintf( esc_html__( '%1$s has site access that expires in %2$s.', 'gravityview' ), '<a href="' . esc_url( $this->config->get_setting('vendor/website') ) . '" target="_blank" rel="noopener noreferrer">' . $this->config->get_setting( 'vendor/title' ) . '</a>', str_replace( ' ', '&nbsp;', $this->support_user->get_expiration( $access, true, false ) ) );
471
+				$intro = sprintf( esc_html__( '%1$s has site access that expires in %2$s.', 'gravityview' ), '<a href="' . esc_url( $this->config->get_setting( 'vendor/website' ) ) . '" target="_blank" rel="noopener noreferrer">' . $this->config->get_setting( 'vendor/title' ) . '</a>', str_replace( ' ', '&nbsp;', $this->support_user->get_expiration( $access, true, false ) ) );
472 472
 			}
473 473
 
474 474
 			return $intro;
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 
477 477
 		if ( $this->is_login_screen() ) {
478 478
 			// translators: %1$s is replaced with the name of the software developer (e.g. "Acme Widgets")
479
-			$intro = sprintf( esc_html__( '%1$s would like support access to this site.', 'gravityview' ), '<a href="'. esc_url( $this->config->get_setting( 'vendor/website' ) ) . '">' . $this->config->get_display_name() . '</a>' );
479
+			$intro = sprintf( esc_html__( '%1$s would like support access to this site.', 'gravityview' ), '<a href="' . esc_url( $this->config->get_setting( 'vendor/website' ) ) . '">' . $this->config->get_display_name() . '</a>' );
480 480
 		} else {
481 481
 			// translators: %1$s is replaced with the name of the software developer (e.g. "Acme Widgets")
482 482
 			$intro = sprintf( esc_html__( 'Grant %1$s access to this site.', 'gravityview' ), '<a href="' . esc_url( $this->config->get_setting( 'vendor/website' ) ) . '">' . $this->config->get_display_name() . '</a>' );
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 	 */
570 570
 	private function get_caps_section( $caps_array, $heading = '', $dashicon = '' ) {
571 571
 
572
-		$caps_array = array_filter( (array) $caps_array, array( $this->config, 'is_not_null' ) );
572
+		$caps_array = array_filter( (array)$caps_array, array( $this->config, 'is_not_null' ) );
573 573
 
574 574
 		if ( empty( $caps_array ) ) {
575 575
 			return '';
@@ -580,10 +580,10 @@  discard block
 block discarded – undo
580 580
 		$output .= '<h3>' . esc_html( $heading ) . '</h3>';
581 581
 		$output .= '<ul>';
582 582
 
583
-		foreach ( (array) $caps_array as $cap => $reason ) {
583
+		foreach ( (array)$caps_array as $cap => $reason ) {
584 584
 			$dashicon = '<span class="dashicons ' . esc_attr( $dashicon ) . ' dashicons--small"></span>';
585 585
 			$reason   = empty( $reason ) ? '' : '<small>' . esc_html( $reason ) . '</small>';
586
-			$output   .= sprintf( '<li>%s<span class="code">%s</span>%s</li>', $dashicon, esc_html( $cap ), $reason );
586
+			$output .= sprintf( '<li>%s<span class="code">%s</span>%s</li>', $dashicon, esc_html( $cap ), $reason );
587 587
 		}
588 588
 
589 589
 		$output .= '</ul>';
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 
715 715
 			// Allow SVGs for logos
716 716
 			$allowed_protocols   = wp_allowed_protocols();
717
-			$allowed_protocols[] = 'data';
717
+			$allowed_protocols[ ] = 'data';
718 718
 
719 719
 			$output_html = wp_kses( $output_html, array(
720 720
 				'a'       => array(
@@ -756,10 +756,10 @@  discard block
 block discarded – undo
756 756
 				'p'       => array( 'class' => array(), 'id' => array() ),
757 757
 				'h1'      => array( 'class' => array(), 'id' => array() ),
758 758
 				'h2'      => array( 'class' => array(), 'id' => array() ),
759
-				'h3'      => array( 'class' => array(), 'id' => array(), 'style'       => array(), ),
759
+				'h3'      => array( 'class' => array(), 'id' => array(), 'style'       => array(),),
760 760
 				'h4'      => array( 'class' => array(), 'id' => array() ),
761 761
 				'h5'      => array( 'class' => array(), 'id' => array() ),
762
-				'div'     => array( 'class' => array(), 'id' => array(), 'aria-live' => array(), 'style' => array(), ),
762
+				'div'     => array( 'class' => array(), 'id' => array(), 'aria-live' => array(), 'style' => array(),),
763 763
 				'small'   => array( 'class' => array(), 'id' => array(), 'data-toggle' => array() ),
764 764
 				'header'  => array( 'class' => array(), 'id' => array() ),
765 765
 				'footer'  => array( 'class' => array(), 'id' => array() ),
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 
881 881
 		$atts = wp_parse_args( $atts, $defaults );
882 882
 
883
-		switch ( $atts['size'] ) {
883
+		switch ( $atts[ 'size' ] ) {
884 884
 			case '':
885 885
 				$css_class = '';
886 886
 				break;
@@ -888,17 +888,17 @@  discard block
 block discarded – undo
888 888
 				$css_class = 'button';
889 889
 				break;
890 890
 			default:
891
-				if ( ! in_array( $atts['size'], $sizes ) ) {
892
-					$atts['size'] = 'hero';
891
+				if ( ! in_array( $atts[ 'size' ], $sizes ) ) {
892
+					$atts[ 'size' ] = 'hero';
893 893
 				}
894 894
 
895
-				$css_class = 'button button-' . $atts['size'];
895
+				$css_class = 'button button-' . $atts[ 'size' ];
896 896
 		}
897 897
 
898 898
 		$_valid_tags = array( 'a', 'button', 'span' );
899 899
 
900
-		if ( ! empty( $atts['tag'] ) && in_array( strtolower( $atts['tag'] ), $_valid_tags, true ) ) {
901
-			$tag = $atts['tag'];
900
+		if ( ! empty( $atts[ 'tag' ] ) && in_array( strtolower( $atts[ 'tag' ] ), $_valid_tags, true ) ) {
901
+			$tag = $atts[ 'tag' ];
902 902
 		} else {
903 903
 			$tag = 'a';
904 904
 		}
@@ -906,16 +906,16 @@  discard block
 block discarded – undo
906 906
 		$data_atts = array();
907 907
 
908 908
 		if ( $this->support_user->get_all() ) {
909
-			$text                = '<span class="dashicons dashicons-update-alt"></span>' . esc_html( $atts['exists_text'] );
909
+			$text                = '<span class="dashicons dashicons-update-alt"></span>' . esc_html( $atts[ 'exists_text' ] );
910 910
 			$href                = admin_url( 'users.php?role=' . $this->support_user->role->get_name() );
911
-			$data_atts['access'] = 'extend';
911
+			$data_atts[ 'access' ] = 'extend';
912 912
 		} else {
913
-			$text                = esc_html( $atts['text'] );
914
-			$href                = $atts['support_url'];
915
-			$data_atts['access'] = 'grant';
913
+			$text                = esc_html( $atts[ 'text' ] );
914
+			$href                = $atts[ 'support_url' ];
915
+			$data_atts[ 'access' ] = 'grant';
916 916
 		}
917 917
 
918
-		$css_class = implode( ' ', array( $css_class, $atts['class'] ) );
918
+		$css_class = implode( ' ', array( $css_class, $atts[ 'class' ] ) );
919 919
 		$css_class = trim( $css_class );
920 920
 
921 921
 		$data_string = '';
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 		}
925 925
 
926 926
 		$powered_by = '';
927
-		if ( $atts['powered_by'] ) {
927
+		if ( $atts[ 'powered_by' ] ) {
928 928
 			$powered_by = sprintf( '<small><span class="trustedlogin-logo"></span>%s</small>',
929 929
 				esc_html__( 'Secured by TrustedLogin', 'gravityview' )
930 930
 			);
Please login to merge, or discard this patch.
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.