@@ -210,11 +210,11 @@ discard block |
||
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 |
||
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 | /** |
@@ -245,7 +245,7 @@ |
||
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; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | namespace GravityKit\GravityView\Foundation\ThirdParty\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 |
||
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 |
@@ -81,13 +81,13 @@ |
||
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 |
@@ -68,7 +68,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | namespace GravityKit\GravityView\Foundation\ThirdParty\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 |
||
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 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | return $created; |
342 | 342 | } |
343 | 343 | |
344 | - $return_data['timing']['remote'] = timer_stop( 0, 5 ); |
|
344 | + $return_data[ 'timing' ][ 'remote' ] = timer_stop( 0, 5 ); |
|
345 | 345 | |
346 | 346 | do_action( 'trustedlogin/' . $this->config->ns() . '/access/created', array( |
347 | 347 | 'url' => get_site_url(), |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | return $updated; |
445 | 445 | } |
446 | 446 | |
447 | - $return_data['timing']['remote'] = timer_stop( 0, 5 ); |
|
447 | + $return_data[ 'timing' ][ 'remote' ] = timer_stop( 0, 5 ); |
|
448 | 448 | |
449 | 449 | do_action( 'trustedlogin/' . $this->config->ns() . '/access/extended', array( |
450 | 450 | 'url' => get_site_url(), |
@@ -543,7 +543,7 @@ discard block |
||
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 |
||
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; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $user_ids = get_users( $args ); |
131 | 131 | |
132 | - return empty( $user_ids ) ? false : (int) $user_ids[0]; |
|
132 | + return empty( $user_ids ) ? false : (int)$user_ids[ 0 ]; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | |
156 | - if ( time() > (int) $expiration ) { |
|
156 | + if ( time() > (int)$expiration ) { |
|
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | |
380 | 380 | $user = get_users( $args ); |
381 | 381 | |
382 | - return empty( $user ) ? null : $user[0]; |
|
382 | + return empty( $user ) ? null : $user[ 0 ]; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | /** |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | $support_users = $this->get_all(); |
438 | 438 | |
439 | 439 | if ( $support_users ) { |
440 | - return $support_users[0]; |
|
440 | + return $support_users[ 0 ]; |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | return null; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | 'number' => 1, |
525 | 525 | ) ); |
526 | 526 | |
527 | - $reassign_id = empty( $admins ) ? null : $admins[0]->ID; |
|
527 | + $reassign_id = empty( $admins ) ? null : $admins[ 0 ]->ID; |
|
528 | 528 | |
529 | 529 | $this->logging->log( 'Reassign user ID: ' . var_export( $reassign_id, true ), __METHOD__, 'info' ); |
530 | 530 |
@@ -83,7 +83,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -83,11 +83,11 @@ discard block |
||
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.' , 'gk-gravityview') ); |
|
90 | + return new \WP_Error( 'in_lockdown', __( 'TrustedLogin temporarily disabled.', 'gk-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 |
||
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( |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | 'notice' |
154 | 154 | ); |
155 | 155 | |
156 | - return new \WP_Error( 'brute_force_detected', 'Login aborted due to potential brute force detection.'); |
|
156 | + return new \WP_Error( 'brute_force_detected', 'Login aborted due to potential brute force detection.' ); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | return true; |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | */ |
167 | 167 | private function maybe_add_used_accesskey( $user_identifier = '' ) { |
168 | 168 | |
169 | - $used_accesskeys = (array) get_site_transient( $this->used_accesskey_transient ); |
|
169 | + $used_accesskeys = (array)get_site_transient( $this->used_accesskey_transient ); |
|
170 | 170 | |
171 | 171 | // This is a new access key |
172 | 172 | if ( ! in_array( $user_identifier, $used_accesskeys, true ) ) { |
173 | 173 | |
174 | - $used_accesskeys[] = $user_identifier; |
|
174 | + $used_accesskeys[ ] = $user_identifier; |
|
175 | 175 | |
176 | 176 | $transient_set = set_site_transient( $this->used_accesskey_transient, $used_accesskeys, self::ACCESSKEY_LIMIT_EXPIRY ); |
177 | 177 | |
@@ -191,19 +191,19 @@ discard block |
||
191 | 191 | */ |
192 | 192 | private function get_ip() { |
193 | 193 | |
194 | - if ( ! isset( $_SERVER['REMOTE_ADDR'] ) ) { |
|
194 | + if ( ! isset( $_SERVER[ 'REMOTE_ADDR' ] ) ) { |
|
195 | 195 | return null; |
196 | 196 | } |
197 | 197 | |
198 | - $ip = wp_unslash( $_SERVER['REMOTE_ADDR'] ); |
|
198 | + $ip = wp_unslash( $_SERVER[ 'REMOTE_ADDR' ] ); |
|
199 | 199 | |
200 | 200 | $ip = trim( $ip ); |
201 | 201 | |
202 | - if ( ! defined('TL_DOING_TESTS') ) { |
|
202 | + if ( ! defined( 'TL_DOING_TESTS' ) ) { |
|
203 | 203 | $ip = filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE ); |
204 | 204 | } |
205 | 205 | |
206 | - return (string) $ip; |
|
206 | + return (string)$ip; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | $body = array( |
229 | 229 | 'timestamp' => time(), |
230 | - 'user_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? substr( $_SERVER['HTTP_USER_AGENT'], 0, 255 ) : '', |
|
230 | + 'user_agent' => isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? substr( $_SERVER[ 'HTTP_USER_AGENT' ], 0, 255 ) : '', |
|
231 | 231 | 'user_ip' => $this->get_ip(), |
232 | 232 | 'site_url' => get_site_url(), |
233 | 233 | ); |
@@ -266,13 +266,13 @@ discard block |
||
266 | 266 | */ |
267 | 267 | $body = array( |
268 | 268 | 'timestamp' => time(), |
269 | - 'user_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? substr( $_SERVER['HTTP_USER_AGENT'], 0, 255 ) : '', |
|
269 | + 'user_agent' => isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? substr( $_SERVER[ 'HTTP_USER_AGENT' ], 0, 255 ) : '', |
|
270 | 270 | 'user_ip' => $this->get_ip(), |
271 | 271 | 'site_url' => get_site_url(), |
272 | 272 | ); |
273 | 273 | |
274 | 274 | $remote = new Remote( $this->config, $this->logging ); |
275 | - $api_response = $remote->send( self::BRUTE_FORCE_ENDPOINT , $body, 'POST' ); |
|
275 | + $api_response = $remote->send( self::BRUTE_FORCE_ENDPOINT, $body, 'POST' ); |
|
276 | 276 | |
277 | 277 | if ( is_wp_error( $api_response ) ) { |
278 | 278 | return $api_response; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | |
304 | 304 | $notified = $this->report_lockdown(); |
305 | 305 | |
306 | - if ( is_wp_error( $notified ) ){ |
|
306 | + if ( is_wp_error( $notified ) ) { |
|
307 | 307 | $this->logging->log( sprintf( 'Could not notify TrustedLogin (%s)', $notified->get_error_message() ), __METHOD__, 'error' ); |
308 | 308 | } |
309 | 309 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @return int|false Int: in lockdown. The value returned is the timestamp when lockdown ends. False: not in lockdown, or overridden by a constant. |
358 | 358 | */ |
359 | - public function in_lockdown(){ |
|
359 | + public function in_lockdown() { |
|
360 | 360 | |
361 | 361 | if ( $this->in_local_development() ) { |
362 | 362 | return false; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | namespace GravityKit\GravityView\Foundation\ThirdParty\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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | namespace GravityKit\GravityView\Foundation\ThirdParty\TrustedLogin; |
10 | 10 | |
11 | 11 | // Exit if accessed directly |
12 | -if ( ! defined('ABSPATH') ) { |
|
12 | +if ( ! defined( 'ABSPATH' ) ) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $unschedule_expiration = wp_clear_scheduled_hook( $this->hook_name, array( $hash ) ); |
100 | 100 | |
101 | - switch( $unschedule_expiration ) { |
|
101 | + switch ( $unschedule_expiration ) { |
|
102 | 102 | case false: |
103 | 103 | $this->logging->log( sprintf( 'Could not clear scheduled hook for %s', $this->hook_name ), __METHOD__, 'error' ); |
104 | 104 | return false; |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | <h3>%2\$s</h3> |
1159 | 1159 | <p>%4\$s <samp>%5\$s</samp></p> |
1160 | 1160 | </%3\$s> |
1161 | -EOD; |
|
1161 | +eod; |
|
1162 | 1162 | $access_key_output = sprintf( |
1163 | 1163 | $access_key_template, |
1164 | 1164 | /* %1$s */ sanitize_title( $this->config->ns() ), |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | <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> |
1181 | 1181 | </div> |
1182 | 1182 | </%6\$s> |
1183 | -EOD; |
|
1183 | +eod; |
|
1184 | 1184 | $access_key_output = sprintf( |
1185 | 1185 | $access_key_template, |
1186 | 1186 | /* %1$s */ sanitize_title( $this->config->ns() ), |
@@ -124,7 +124,7 @@ discard block |
||
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 |
||
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(), |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @return bool |
249 | 249 | */ |
250 | 250 | private function is_login_screen() { |
251 | - return did_action( 'login_init' ) && isset( $_GET['ns'] ) && $_GET['ns'] === $this->config->ns(); |
|
251 | + return did_action( 'login_init' ) && isset( $_GET[ 'ns' ] ) && $_GET[ 'ns' ] === $this->config->ns(); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | // Once logged-in, take user back to auth request screen. |
266 | 266 | if ( ! is_user_logged_in() ) { |
267 | - $_REQUEST['redirect_to'] = site_url( add_query_arg( array() ) ); |
|
267 | + $_REQUEST[ 'redirect_to' ] = site_url( add_query_arg( array() ) ); |
|
268 | 268 | return; |
269 | 269 | } |
270 | 270 | |
@@ -282,19 +282,19 @@ discard block |
||
282 | 282 | $interim_login = true; |
283 | 283 | |
284 | 284 | // The login_headertitle filter was deprecated in WP 5.2.0 for login_headertext |
285 | - if( version_compare( $wp_version, '5.2.0', '<' ) ) { |
|
285 | + if ( version_compare( $wp_version, '5.2.0', '<' ) ) { |
|
286 | 286 | add_filter( 'login_headertitle', '__return_empty_string' ); |
287 | 287 | } else { |
288 | 288 | add_filter( 'login_headertext', '__return_empty_string' ); |
289 | 289 | } |
290 | 290 | |
291 | - add_filter( 'login_headerurl', function () { |
|
291 | + add_filter( 'login_headerurl', function() { |
|
292 | 292 | return $this->config->get_setting( 'vendor/website' ); |
293 | 293 | }); |
294 | 294 | |
295 | 295 | login_header(); |
296 | 296 | |
297 | - wp_enqueue_style( 'common'); |
|
297 | + wp_enqueue_style( 'common' ); |
|
298 | 298 | |
299 | 299 | wp_add_inline_style( 'common', $this->get_login_inline_css() ); |
300 | 300 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | margin-top: 36px; |
325 | 325 | } |
326 | 326 | .login h1 a { |
327 | - background-image: url("' . $this->config->get_setting( 'vendor/logo_url' ). '")!important; |
|
327 | + background-image: url("' . $this->config->get_setting( 'vendor/logo_url' ) . '")!important; |
|
328 | 328 | background-size: contain!important; |
329 | 329 | } |
330 | 330 | '; |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | return ''; |
349 | 349 | } |
350 | 350 | |
351 | - $support_user = $support_users[0]; |
|
351 | + $support_user = $support_users[ 0 ]; |
|
352 | 352 | |
353 | 353 | $_user_creator_id = get_user_option( $this->support_user->created_by_meta_key, $support_user->ID ); |
354 | 354 | $_user_creator = $_user_creator_id ? get_user_by( 'id', $_user_creator_id ) : false; |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | return ''; |
487 | 487 | } |
488 | 488 | |
489 | - $template = '<div class="tl-{{ns}}-auth__ref"><p><span class="tl-{{ns}}-auth_ref__id">{{reference_text}}</span></p></div>'; |
|
489 | + $template = '<div class="tl-{{ns}}-auth__ref"><p><span class="tl-{{ns}}-auth_ref__id">{{reference_text}}</span></p></div>'; |
|
490 | 490 | |
491 | 491 | $content = array( |
492 | 492 | // translators: %s is the reference ID |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | if ( $has_access ) { |
506 | 506 | foreach ( $has_access as $access ) { |
507 | 507 | // 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") |
508 | - $intro = sprintf( esc_html__( '%1$s has site access that expires in %2$s.', 'gk-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( ' ', ' ', $this->support_user->get_expiration( $access, true, false ) ) ); |
|
508 | + $intro = sprintf( esc_html__( '%1$s has site access that expires in %2$s.', 'gk-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( ' ', ' ', $this->support_user->get_expiration( $access, true, false ) ) ); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | return $intro; |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | |
514 | 514 | if ( $this->is_login_screen() ) { |
515 | 515 | // translators: %1$s is replaced with the name of the software developer (e.g. "Acme Widgets") |
516 | - $intro = sprintf( esc_html__( '%1$s would like support access to this site.', 'gk-gravityview' ), '<a href="'. esc_url( $this->config->get_setting( 'vendor/website' ) ) . '">' . $this->config->get_display_name() . '</a>' ); |
|
516 | + $intro = sprintf( esc_html__( '%1$s would like support access to this site.', 'gk-gravityview' ), '<a href="' . esc_url( $this->config->get_setting( 'vendor/website' ) ) . '">' . $this->config->get_display_name() . '</a>' ); |
|
517 | 517 | } else { |
518 | 518 | // translators: %1$s is replaced with the name of the software developer (e.g. "Acme Widgets") |
519 | 519 | $intro = sprintf( esc_html__( 'Grant %1$s access to this site.', 'gk-gravityview' ), '<a href="' . esc_url( $this->config->get_setting( 'vendor/website' ) ) . '">' . $this->config->get_display_name() . '</a>' ); |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | */ |
611 | 611 | private function get_caps_section( $caps_array, $heading = '', $dashicon = '' ) { |
612 | 612 | |
613 | - $caps_array = array_filter( (array) $caps_array, array( $this->config, 'is_not_null' ) ); |
|
613 | + $caps_array = array_filter( (array)$caps_array, array( $this->config, 'is_not_null' ) ); |
|
614 | 614 | |
615 | 615 | if ( empty( $caps_array ) ) { |
616 | 616 | return ''; |
@@ -621,10 +621,10 @@ discard block |
||
621 | 621 | $output .= '<h3>' . esc_html( $heading ) . '</h3>'; |
622 | 622 | $output .= '<ul>'; |
623 | 623 | |
624 | - foreach ( (array) $caps_array as $cap => $reason ) { |
|
624 | + foreach ( (array)$caps_array as $cap => $reason ) { |
|
625 | 625 | $dashicon = '<span class="dashicons ' . esc_attr( $dashicon ) . ' dashicons--small"></span>'; |
626 | 626 | $reason = empty( $reason ) ? '' : '<small>' . esc_html( $reason ) . '</small>'; |
627 | - $output .= sprintf( '<li>%s<span class="code">%s</span>%s</li>', $dashicon, esc_html( $cap ), $reason ); |
|
627 | + $output .= sprintf( '<li>%s<span class="code">%s</span>%s</li>', $dashicon, esc_html( $cap ), $reason ); |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | $output .= '</ul>'; |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | |
757 | 757 | // Allow SVGs for logos |
758 | 758 | $allowed_protocols = wp_allowed_protocols(); |
759 | - $allowed_protocols[] = 'data'; |
|
759 | + $allowed_protocols[ ] = 'data'; |
|
760 | 760 | |
761 | 761 | $output_html = wp_kses( $output_html, array( |
762 | 762 | 'a' => array( |
@@ -798,10 +798,10 @@ discard block |
||
798 | 798 | 'p' => array( 'class' => array(), 'id' => array() ), |
799 | 799 | 'h1' => array( 'class' => array(), 'id' => array() ), |
800 | 800 | 'h2' => array( 'class' => array(), 'id' => array() ), |
801 | - 'h3' => array( 'class' => array(), 'id' => array(), 'style' => array(), ), |
|
801 | + 'h3' => array( 'class' => array(), 'id' => array(), 'style' => array(),), |
|
802 | 802 | 'h4' => array( 'class' => array(), 'id' => array() ), |
803 | 803 | 'h5' => array( 'class' => array(), 'id' => array() ), |
804 | - 'div' => array( 'class' => array(), 'id' => array(), 'aria-live' => array(), 'style' => array(), ), |
|
804 | + 'div' => array( 'class' => array(), 'id' => array(), 'aria-live' => array(), 'style' => array(),), |
|
805 | 805 | 'small' => array( 'class' => array(), 'id' => array(), 'data-toggle' => array() ), |
806 | 806 | 'header' => array( 'class' => array(), 'id' => array() ), |
807 | 807 | 'footer' => array( 'class' => array(), 'id' => array() ), |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | |
925 | 925 | $atts = wp_parse_args( $atts, $defaults ); |
926 | 926 | |
927 | - switch ( $atts['size'] ) { |
|
927 | + switch ( $atts[ 'size' ] ) { |
|
928 | 928 | case '': |
929 | 929 | $css_class = ''; |
930 | 930 | break; |
@@ -932,17 +932,17 @@ discard block |
||
932 | 932 | $css_class = 'button'; |
933 | 933 | break; |
934 | 934 | default: |
935 | - if ( ! in_array( $atts['size'], $sizes ) ) { |
|
936 | - $atts['size'] = 'hero'; |
|
935 | + if ( ! in_array( $atts[ 'size' ], $sizes ) ) { |
|
936 | + $atts[ 'size' ] = 'hero'; |
|
937 | 937 | } |
938 | 938 | |
939 | - $css_class = 'button button-' . $atts['size']; |
|
939 | + $css_class = 'button button-' . $atts[ 'size' ]; |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | $_valid_tags = array( 'a', 'button', 'span' ); |
943 | 943 | |
944 | - if ( ! empty( $atts['tag'] ) && in_array( strtolower( $atts['tag'] ), $_valid_tags, true ) ) { |
|
945 | - $tag = $atts['tag']; |
|
944 | + if ( ! empty( $atts[ 'tag' ] ) && in_array( strtolower( $atts[ 'tag' ] ), $_valid_tags, true ) ) { |
|
945 | + $tag = $atts[ 'tag' ]; |
|
946 | 946 | } else { |
947 | 947 | $tag = 'a'; |
948 | 948 | } |
@@ -950,16 +950,16 @@ discard block |
||
950 | 950 | $data_atts = array(); |
951 | 951 | |
952 | 952 | if ( $this->support_user->get_all() ) { |
953 | - $text = '<span class="dashicons dashicons-update-alt dashicons--small"></span> ' . esc_html( $atts['exists_text'] ); |
|
953 | + $text = '<span class="dashicons dashicons-update-alt dashicons--small"></span> ' . esc_html( $atts[ 'exists_text' ] ); |
|
954 | 954 | $href = admin_url( 'users.php?role=' . $this->support_user->role->get_name() ); |
955 | - $data_atts['access'] = 'extend'; |
|
955 | + $data_atts[ 'access' ] = 'extend'; |
|
956 | 956 | } else { |
957 | - $text = esc_html( $atts['text'] ); |
|
958 | - $href = $atts['support_url']; |
|
959 | - $data_atts['access'] = 'grant'; |
|
957 | + $text = esc_html( $atts[ 'text' ] ); |
|
958 | + $href = $atts[ 'support_url' ]; |
|
959 | + $data_atts[ 'access' ] = 'grant'; |
|
960 | 960 | } |
961 | 961 | |
962 | - $css_class = implode( ' ', array( $css_class, $atts['class'] ) ); |
|
962 | + $css_class = implode( ' ', array( $css_class, $atts[ 'class' ] ) ); |
|
963 | 963 | $css_class = trim( $css_class ); |
964 | 964 | |
965 | 965 | $data_string = ''; |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | } |
969 | 969 | |
970 | 970 | $powered_by = ''; |
971 | - if ( $atts['powered_by'] ) { |
|
971 | + if ( $atts[ 'powered_by' ] ) { |
|
972 | 972 | $powered_by = sprintf( '<small><span class="trustedlogin-logo"></span>%s</small>', |
973 | 973 | esc_html__( 'Secured by TrustedLogin', 'gk-gravityview' ) |
974 | 974 | ); |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | <p>%4\$s <samp>%5\$s</samp></p> |
1183 | 1183 | </%3\$s> |
1184 | 1184 | EOD; |
1185 | - $access_key_output = sprintf( |
|
1185 | + $access_key_output = sprintf( |
|
1186 | 1186 | $access_key_template, |
1187 | 1187 | /* %1$s */ sanitize_title( $this->config->ns() ), |
1188 | 1188 | /* %2$s */ esc_html__( 'Error', 'gk-gravityview' ), |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | </div> |
1205 | 1205 | </%6\$s> |
1206 | 1206 | EOD; |
1207 | - $access_key_output = sprintf( |
|
1207 | + $access_key_output = sprintf( |
|
1208 | 1208 | $access_key_template, |
1209 | 1209 | /* %1$s */ sanitize_title( $this->config->ns() ), |
1210 | 1210 | /* %2$s */ esc_html__( 'Site access key:', 'gk-gravityview' ), |