@@ -9,7 +9,7 @@ discard block |
||
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 |
||
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 | } |
@@ -89,7 +89,7 @@ |
||
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 |
@@ -13,7 +13,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -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(), |
@@ -225,7 +225,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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( ' ', ' ', $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( ' ', ' ', $this->support_user->get_expiration( $access, true, false ) ) ); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | return $intro; |
@@ -476,7 +476,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | ); |
@@ -13,7 +13,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -131,11 +131,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | /** |
@@ -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.' , '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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | function __construct() { |
6 | 6 | |
7 | - if( ! is_admin() ) { return; } |
|
7 | + if ( ! is_admin() ) { return; } |
|
8 | 8 | |
9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
10 | - if( false === gravityview()->plugin->is_compatible() ) { |
|
10 | + if ( false === gravityview()->plugin->is_compatible() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
49 | 49 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
50 | 50 | |
51 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
51 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
52 | 52 | |
53 | 53 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
54 | 54 | |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public static function no_views_text() { |
66 | 66 | |
67 | - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
|
67 | + if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) { |
|
68 | 68 | return esc_html__( 'No Views found in Trash', 'gravityview' ); |
69 | - } elseif( ! empty( $_GET['s'] ) ) { |
|
69 | + } elseif ( ! empty( $_GET[ 's' ] ) ) { |
|
70 | 70 | return esc_html__( 'No Views found.', 'gravityview' ); |
71 | 71 | } |
72 | 72 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $error .= ' ' . esc_html__( 'or select another form.', 'gravityview' ); |
111 | 111 | } |
112 | 112 | |
113 | - if( $error ) { |
|
113 | + if ( $error ) { |
|
114 | 114 | ?> |
115 | 115 | <div class="wp-dialog notice-warning inline error wp-clearfix"> |
116 | 116 | <?php echo gravityview_get_floaty(); ?> |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | public function backend_actions() { |
131 | 131 | |
132 | 132 | /** @define "GRAVITYVIEW_DIR" "../" */ |
133 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
134 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
135 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
136 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
137 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
138 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
139 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
140 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-installer.php' ); |
|
141 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
142 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
143 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-bulk-actions.php' ); |
|
133 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
134 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
135 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
136 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
137 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
138 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
139 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
140 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-installer.php' ); |
|
141 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
142 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
143 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-bulk-actions.php' ); |
|
144 | 144 | |
145 | 145 | /** |
146 | 146 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
147 | 147 | * |
148 | 148 | * Nice place to insert extensions' backend stuff |
149 | 149 | */ |
150 | - do_action('gravityview_include_backend_actions'); |
|
150 | + do_action( 'gravityview_include_backend_actions' ); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | |
163 | 163 | $actions = array(); |
164 | 164 | |
165 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
166 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
165 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
166 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
167 | 167 | } |
168 | 168 | |
169 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
170 | - $actions[] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
169 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
170 | + $actions[ ] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | return array_merge( $actions, $links ); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | // By default, there will only be one item being modified. |
196 | 196 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
197 | 197 | // of modified items that will override this array. |
198 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
198 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
199 | 199 | |
200 | 200 | // If we're starting fresh, a new form was created. |
201 | 201 | // We should let the user know this is the case. |
@@ -203,60 +203,60 @@ discard block |
||
203 | 203 | |
204 | 204 | $new_form_text = ''; |
205 | 205 | |
206 | - if( !empty( $start_fresh ) ) { |
|
206 | + if ( ! empty( $start_fresh ) ) { |
|
207 | 207 | |
208 | 208 | // Get the form that was created |
209 | 209 | $connected_form = gravityview_get_form_id( $post_id ); |
210 | 210 | |
211 | - if( !empty( $connected_form ) ) { |
|
211 | + if ( ! empty( $connected_form ) ) { |
|
212 | 212 | $form = gravityview_get_form( $connected_form ); |
213 | - $form_name = esc_attr( $form['title'] ); |
|
213 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
214 | 214 | $image = self::get_floaty(); |
215 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
216 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
215 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
216 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
217 | 217 | |
218 | 218 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
219 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
219 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
220 | 220 | $new_form_text = wpautop( $new_form_text ); |
221 | 221 | |
222 | 222 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
226 | - $messages['gravityview'] = array( |
|
226 | + $messages[ 'gravityview' ] = array( |
|
227 | 227 | 0 => '', // Unused. Messages start at index 1. |
228 | 228 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
229 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
229 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
230 | 230 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
231 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
231 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
232 | 232 | 3 => __( 'View deleted.', 'gravityview' ), |
233 | 233 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
234 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
234 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
235 | 235 | /* translators: %s: date and time of the revision */ |
236 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
236 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
237 | 237 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
238 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
238 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
239 | 239 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
240 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
240 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
241 | 241 | 8 => __( 'View submitted.', 'gravityview' ), |
242 | 242 | 9 => sprintf( |
243 | 243 | /* translators: Date and time the View is scheduled to be published */ |
244 | 244 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
245 | 245 | // translators: Publish box date format, see http://php.net/date |
246 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
246 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
247 | 247 | ) . $new_form_text, |
248 | 248 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
249 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
249 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * These apply to `bulk_post_updated_messages` |
253 | 253 | * @file wp-admin/edit.php |
254 | 254 | */ |
255 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
256 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
257 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
258 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
259 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
255 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
256 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
257 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
258 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
259 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
260 | 260 | ); |
261 | 261 | |
262 | 262 | return $messages; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips' ) ); |
50 | 50 | |
51 | 51 | // adding styles and scripts |
52 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
52 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
53 | 53 | // bypass Gravity Forms no-conflict mode |
54 | 54 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
55 | 55 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them. |
79 | 79 | * @param array $form GF Form object of current form |
80 | 80 | */ |
81 | - if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
81 | + if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
82 | 82 | return $filter_links; |
83 | 83 | } |
84 | 84 | |
@@ -106,27 +106,27 @@ discard block |
||
106 | 106 | $approved_count = $disapproved_count = $unapproved_count = 0; |
107 | 107 | |
108 | 108 | // Only count if necessary |
109 | - if( $include_counts ) { |
|
110 | - $approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
111 | - $disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
112 | - $unapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_unapproved ) ) ); |
|
109 | + if ( $include_counts ) { |
|
110 | + $approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
111 | + $disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
112 | + $unapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_unapproved ) ) ); |
|
113 | 113 | } |
114 | 114 | |
115 | - $filter_links[] = array( |
|
115 | + $filter_links[ ] = array( |
|
116 | 116 | 'id' => 'gv_approved', |
117 | 117 | 'field_filters' => $field_filters_approved, |
118 | 118 | 'count' => $approved_count, |
119 | 119 | 'label' => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ), |
120 | 120 | ); |
121 | 121 | |
122 | - $filter_links[] = array( |
|
122 | + $filter_links[ ] = array( |
|
123 | 123 | 'id' => 'gv_disapproved', |
124 | 124 | 'field_filters' => $field_filters_disapproved, |
125 | 125 | 'count' => $disapproved_count, |
126 | 126 | 'label' => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::DISAPPROVED ), |
127 | 127 | ); |
128 | 128 | |
129 | - $filter_links[] = array( |
|
129 | + $filter_links[ ] = array( |
|
130 | 130 | 'id' => 'gv_unapproved', |
131 | 131 | 'field_filters' => $field_filters_unapproved, |
132 | 132 | 'count' => $unapproved_count, |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function tooltips( $tooltips ) { |
147 | 147 | |
148 | - $tooltips['form_gravityview_fields'] = array( |
|
149 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
150 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
148 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
149 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
150 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
151 | 151 | ); |
152 | 152 | |
153 | 153 | return $tooltips; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * |
261 | 261 | * @return boolean True: It worked; False: it failed |
262 | 262 | */ |
263 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
263 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
264 | 264 | return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn ); |
265 | 265 | } |
266 | 266 | |
@@ -290,20 +290,20 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @return void |
292 | 292 | */ |
293 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
293 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
294 | 294 | |
295 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
295 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
296 | 296 | return; |
297 | 297 | } |
298 | 298 | |
299 | - if( empty( $entry['id'] ) ) { |
|
299 | + if ( empty( $entry[ 'id' ] ) ) { |
|
300 | 300 | return; |
301 | 301 | } |
302 | 302 | |
303 | 303 | $status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' ); |
304 | 304 | |
305 | - if( $status_value ) { |
|
306 | - echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />'; |
|
305 | + if ( $status_value ) { |
|
306 | + echo '<input type="hidden" class="entry_approval" id="entry_approved_' . $entry[ 'id' ] . '" value="' . esc_attr( $status_value ) . '" />'; |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
@@ -316,10 +316,10 @@ discard block |
||
316 | 316 | */ |
317 | 317 | private function get_form_id() { |
318 | 318 | |
319 | - $form_id = GFForms::get('id'); |
|
319 | + $form_id = GFForms::get( 'id' ); |
|
320 | 320 | |
321 | 321 | // If there are no forms identified, use the first form. That's how GF does it. |
322 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
322 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
323 | 323 | $form_id = $this->get_first_form_id(); |
324 | 324 | } |
325 | 325 | |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | |
340 | 340 | $forms = RGFormsModel::get_forms( null, 'title' ); |
341 | 341 | |
342 | - if( ! isset( $forms[0] ) ) { |
|
342 | + if ( ! isset( $forms[ 0 ] ) ) { |
|
343 | 343 | gravityview()->log->error( 'No forms were found' ); |
344 | 344 | return 0; |
345 | 345 | } |
346 | 346 | |
347 | - $first_form = $forms[0]; |
|
347 | + $first_form = $forms[ 0 ]; |
|
348 | 348 | |
349 | - $form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id']; |
|
349 | + $form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ]; |
|
350 | 350 | |
351 | 351 | return intval( $form_id ); |
352 | 352 | } |
@@ -354,37 +354,37 @@ discard block |
||
354 | 354 | |
355 | 355 | function add_scripts_and_styles( $hook ) { |
356 | 356 | |
357 | - if( ! class_exists( 'GFForms' ) ) { |
|
357 | + if ( ! class_exists( 'GFForms' ) ) { |
|
358 | 358 | gravityview()->log->error( 'GFForms does not exist.' ); |
359 | 359 | return; |
360 | 360 | } |
361 | 361 | |
362 | 362 | // enqueue styles & scripts gf_entries |
363 | 363 | // But only if we're on the main Entries page, not on reports pages |
364 | - if( GFForms::get_page() !== 'entry_list' ) { |
|
364 | + if ( GFForms::get_page() !== 'entry_list' ) { |
|
365 | 365 | return; |
366 | 366 | } |
367 | 367 | |
368 | 368 | $form_id = $this->get_form_id(); |
369 | 369 | |
370 | 370 | // Things are broken; no forms were found |
371 | - if( empty( $form_id ) ) { |
|
371 | + if ( empty( $form_id ) ) { |
|
372 | 372 | return; |
373 | 373 | } |
374 | 374 | |
375 | - wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
375 | + wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
376 | 376 | |
377 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
377 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
378 | 378 | |
379 | - wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
379 | + wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
380 | 380 | |
381 | 381 | wp_enqueue_script( 'gravityview_entries_list-popper', plugins_url( 'assets/lib/tippy/popper.min.js', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
382 | 382 | wp_enqueue_script( 'gravityview_entries_list-tippy', plugins_url( 'assets/lib/tippy/tippy.min.js', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
383 | 383 | wp_enqueue_style( 'gravityview_entries_list-tippy', plugins_url( 'assets/lib/tippy/tippy.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
384 | 384 | |
385 | 385 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
386 | - 'nonce' => wp_create_nonce( 'gravityview_entry_approval'), |
|
387 | - 'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval'), |
|
386 | + 'nonce' => wp_create_nonce( 'gravityview_entry_approval' ), |
|
387 | + 'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval' ), |
|
388 | 388 | 'form_id' => $form_id, |
389 | 389 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
390 | 390 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
@@ -393,10 +393,10 @@ discard block |
||
393 | 393 | 'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED, |
394 | 394 | 'bulk_actions' => GravityView_Bulk_Actions::get_bulk_actions( $form_id ), |
395 | 395 | 'bulk_message' => $this->bulk_update_message, |
396 | - 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'), |
|
397 | - 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
398 | - 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'), |
|
399 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
396 | + 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'unapproved' ), |
|
397 | + 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr( 'disapproved' ), |
|
398 | + 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'approved' ), |
|
399 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
400 | 400 | 'column_link' => esc_url( $this->get_sort_link() ), |
401 | 401 | 'status_popover_template' => GravityView_Entry_Approval::get_popover_template(), |
402 | 402 | 'status_popover_placement' => GravityView_Entry_Approval::get_popover_placement(), |
@@ -444,13 +444,13 @@ discard block |
||
444 | 444 | * @since 1.7.2 |
445 | 445 | * @param boolean $hide_if_no_connections |
446 | 446 | */ |
447 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
447 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
448 | 448 | |
449 | - if( $hide_if_no_connections ) { |
|
449 | + if ( $hide_if_no_connections ) { |
|
450 | 450 | |
451 | 451 | $connected_views = gravityview_get_connected_views( $form_id ); |
452 | 452 | |
453 | - if( empty( $connected_views ) ) { |
|
453 | + if ( empty( $connected_views ) ) { |
|
454 | 454 | $show_approve_column = false; |
455 | 455 | } |
456 | 456 | } |
@@ -460,21 +460,21 @@ discard block |
||
460 | 460 | * @param boolean $show_approve_column Whether the column will be shown |
461 | 461 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
462 | 462 | */ |
463 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
463 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
464 | 464 | |
465 | 465 | return $show_approve_column; |
466 | 466 | } |
467 | 467 | |
468 | 468 | function register_gform_noconflict_script( $scripts ) { |
469 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
470 | - $scripts[] = 'gravityview_entries_list-popper'; |
|
471 | - $scripts[] = 'gravityview_entries_list-tippy'; |
|
469 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
470 | + $scripts[ ] = 'gravityview_entries_list-popper'; |
|
471 | + $scripts[ ] = 'gravityview_entries_list-tippy'; |
|
472 | 472 | return $scripts; |
473 | 473 | } |
474 | 474 | |
475 | 475 | function register_gform_noconflict_style( $styles ) { |
476 | - $styles[] = 'gravityview_entries_list'; |
|
477 | - $styles[] = 'gravityview_entries_list-tippy'; |
|
476 | + $styles[ ] = 'gravityview_entries_list'; |
|
477 | + $styles[ ] = 'gravityview_entries_list-tippy'; |
|
478 | 478 | return $styles; |
479 | 479 | } |
480 | 480 |