Completed
Push — develop ( 1b0bc5...954aba )
by
unknown
20:01 queued 12s
created
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.
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.