Completed
Push — develop ( c5d946...7a38aa )
by
unknown
17:05
created
trustedlogin/trustedlogin/client/src/Envelope.php 1 patch
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.
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/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 1 patch
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.
trustedlogin/trustedlogin/client/src/Admin.php 1 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/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.
future/lib/class-gamajo-template-loader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 		public function set_template_data( $data, $var_name = 'data' ) {
132 132
 			global $wp_query;
133 133
 
134
-			$wp_query->query_vars[ $var_name ] = (object) $data;
134
+			$wp_query->query_vars[ $var_name ] = (object)$data;
135 135
 
136 136
 			// Add $var_name to custom variable store if not default value.
137 137
 			if ( 'data' !== $var_name ) {
138
-				$this->template_data_var_names[] = $var_name;
138
+				$this->template_data_var_names[ ] = $var_name;
139 139
 			}
140 140
 
141 141
 			return $this;
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 		protected function get_template_file_names( $slug, $name ) {
179 179
 			$templates = array();
180 180
 			if ( isset( $name ) ) {
181
-				$templates[] = $slug . '-' . $name . '.php';
181
+				$templates[ ] = $slug . '-' . $name . '.php';
182 182
 			}
183
-			$templates[] = $slug . '.php';
183
+			$templates[ ] = $slug . '.php';
184 184
 
185 185
 			/**
186 186
 			 * Allow template choices to be filtered.
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 				$located = false;
227 227
 
228 228
 				// Remove empty entries.
229
-				$template_names = array_filter( (array) $template_names );
229
+				$template_names = array_filter( (array)$template_names );
230 230
 				$template_paths = $this->get_template_paths();
231 231
 
232 232
 				// Try to find a template file.
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 				}
247 247
 
248 248
 				// The templates weren't found; don't look this up again.
249
-				if( ! $located ) {
249
+				if ( ! $located ) {
250 250
 					$template_path_cache[ $this->filter_prefix ][ $cache_key ] = false;
251 251
 				}
252 252
 			}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
 			// Only add this conditionally, so non-child themes don't redundantly check active theme twice.
287 287
 			if ( get_stylesheet_directory() !== get_template_directory() ) {
288
-				$file_paths[1] = trailingslashit( get_stylesheet_directory() ) . $theme_directory;
288
+				$file_paths[ 1 ] = trailingslashit( get_stylesheet_directory() ) . $theme_directory;
289 289
 			}
290 290
 
291 291
 			/**
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/SecurityChecks.php 1 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.
includes/class-gravityview-bulk-actions.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$gv_bulk_action = false;
56 56
 
57
-		if( version_compare( GFForms::$version, '2.0', '>=' ) ) {
57
+		if ( version_compare( GFForms::$version, '2.0', '>=' ) ) {
58 58
 			$bulk_action = ( '-1' !== \GV\Utils::_POST( 'action' ) ) ? \GV\Utils::_POST( 'action' ) : \GV\Utils::_POST( 'action2' );
59 59
 		} else {
60 60
 			// GF 1.9.x - Bulk action 2 is the bottom bulk action select form.
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		}
63 63
 
64 64
 		// Check the $bulk_action value against GV actions, see if they're the same. I hate strpos().
65
-		if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', self::$bulk_action_prefixes ) .')/ism', $bulk_action ) ) {
65
+		if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', self::$bulk_action_prefixes ) . ')/ism', $bulk_action ) ) {
66 66
 			$gv_bulk_action = $bulk_action;
67 67
 		}
68 68
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
 		// gforms_entry_list is the nonce that confirms we're on the right page
88 88
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
89
-		if ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST['gforms_update_note'] ) ) {
89
+		if ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
90 90
 
91 91
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
92 92
 
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 			}
105 105
 
106 106
 			// All entries are set to be updated, not just the visible ones
107
-			if ( ! empty( $_POST['all_entries'] ) ) {
107
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
108 108
 
109 109
 				// Convert the current entry search into GF-formatted search criteria
110 110
 				$search = array(
111
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
112
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
113
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
111
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
112
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
113
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
114 114
 				);
115 115
 
116 116
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 			} else {
122 122
 
123 123
 				// Changed from 'lead' to 'entry' in 2.0
124
-				$entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry'];
124
+				$entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ];
125 125
 
126 126
 			}
127 127
 
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 			$entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' );
134 134
 
135 135
 			switch ( $approved_status ) {
136
-				case self::$bulk_action_prefixes['approve']:
136
+				case self::$bulk_action_prefixes[ 'approve' ]:
137 137
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::APPROVED, $form_id );
138 138
 					self::$bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count );
139 139
 					break;
140
-				case self::$bulk_action_prefixes['unapprove']:
140
+				case self::$bulk_action_prefixes[ 'unapprove' ]:
141 141
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::UNAPPROVED, $form_id );
142 142
 					self::$bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count );
143 143
 					break;
144
-				case self::$bulk_action_prefixes['disapprove']:
144
+				case self::$bulk_action_prefixes[ 'disapprove' ]:
145 145
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::DISAPPROVED, $form_id );
146 146
 					self::$bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count );
147 147
 					break;
@@ -164,16 +164,16 @@  discard block
 block discarded – undo
164 164
 		$bulk_actions = array(
165 165
 			'GravityView' => array(
166 166
 				array(
167
-					'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'),
168
-					'value' => sprintf( '%s-%d', self::$bulk_action_prefixes['approve'], $form_id ),
167
+					'label' => GravityView_Entry_Approval_Status::get_string( 'approved', 'action' ),
168
+					'value' => sprintf( '%s-%d', self::$bulk_action_prefixes[ 'approve' ], $form_id ),
169 169
 				),
170 170
 				array(
171
-					'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'),
172
-					'value' => sprintf( '%s-%d', self::$bulk_action_prefixes['disapprove'], $form_id ),
171
+					'label' => GravityView_Entry_Approval_Status::get_string( 'disapproved', 'action' ),
172
+					'value' => sprintf( '%s-%d', self::$bulk_action_prefixes[ 'disapprove' ], $form_id ),
173 173
 				),
174 174
 				array(
175
-					'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'),
176
-					'value' => sprintf( '%s-%d', self::$bulk_action_prefixes['unapprove'], $form_id ),
175
+					'label' => GravityView_Entry_Approval_Status::get_string( 'unapproved', 'action' ),
176
+					'value' => sprintf( '%s-%d', self::$bulk_action_prefixes[ 'unapprove' ], $form_id ),
177 177
 				),
178 178
 			),
179 179
 		);
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
 		// Sanitize the values, just to be sure.
191 191
 		foreach ( $bulk_actions as $key => $group ) {
192 192
 
193
-			if( empty( $group ) ) {
193
+			if ( empty( $group ) ) {
194 194
 				continue;
195 195
 			}
196 196
 
197 197
 			foreach ( $group as $i => $action ) {
198
-				$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
199
-				$bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
198
+				$bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] );
199
+				$bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] );
200 200
 			}
201 201
 		}
202 202
 
Please login to merge, or discard this patch.