@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | 'templates/form/submit-button', |
51 | 51 | 'templates/reviews-form', |
52 | 52 | ]; |
53 | - if( !preg_match( '('.implode( '|', $styledViews ).')', $view )) { |
|
53 | + if( !preg_match( '('.implode( '|', $styledViews ).')', $view ) ) { |
|
54 | 54 | return $view; |
55 | 55 | } |
56 | 56 | $views = $this->generatePossibleViews( $view ); |
57 | 57 | foreach( $views as $possibleView ) { |
58 | - if( !file_exists( glsr()->file( $possibleView )))continue; |
|
58 | + if( !file_exists( glsr()->file( $possibleView ) ) )continue; |
|
59 | 59 | return glsr( Helper::class )->removePrefix( 'views/', $possibleView ); |
60 | 60 | } |
61 | 61 | return $view; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function modifyField( Builder $instance ) |
90 | 90 | { |
91 | - if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return; |
|
91 | + if( !$this->isPublicInstance( $instance ) || empty(array_filter( $this->fields )) )return; |
|
92 | 92 | call_user_func_array( [$this, 'customize'], [&$instance] ); |
93 | 93 | } |
94 | 94 | |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function customize( Builder $instance ) |
107 | 107 | { |
108 | - if( !array_key_exists( $instance->tag, $this->fields ))return; |
|
109 | - $args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' )); |
|
108 | + if( !array_key_exists( $instance->tag, $this->fields ) )return; |
|
109 | + $args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ) ); |
|
110 | 110 | $key = $instance->tag.'_'.$args['type']; |
111 | - $classes = !isset( $this->fields[$key] ) |
|
111 | + $classes = !isset($this->fields[$key]) |
|
112 | 112 | ? $this->fields[$instance->tag] |
113 | 113 | : $this->fields[$key]; |
114 | 114 | $instance->args['class'] = trim( $args['class'].' '.$classes ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $args = wp_parse_args( $instance->args, [ |
143 | 143 | 'is_public' => false, |
144 | 144 | 'is_raw' => false, |
145 | - ]); |
|
145 | + ] ); |
|
146 | 146 | if( is_admin() || !$args['is_public'] || $args['is_raw'] ) { |
147 | 147 | return false; |
148 | 148 | } |
@@ -55,7 +55,9 @@ discard block |
||
55 | 55 | } |
56 | 56 | $views = $this->generatePossibleViews( $view ); |
57 | 57 | foreach( $views as $possibleView ) { |
58 | - if( !file_exists( glsr()->file( $possibleView )))continue; |
|
58 | + if( !file_exists( glsr()->file( $possibleView ))) { |
|
59 | + continue; |
|
60 | + } |
|
59 | 61 | return glsr( Helper::class )->removePrefix( 'views/', $possibleView ); |
60 | 62 | } |
61 | 63 | return $view; |
@@ -88,7 +90,9 @@ discard block |
||
88 | 90 | */ |
89 | 91 | public function modifyField( Builder $instance ) |
90 | 92 | { |
91 | - if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return; |
|
93 | + if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields ))) { |
|
94 | + return; |
|
95 | + } |
|
92 | 96 | call_user_func_array( [$this, 'customize'], [&$instance] ); |
93 | 97 | } |
94 | 98 | |
@@ -105,7 +109,9 @@ discard block |
||
105 | 109 | */ |
106 | 110 | protected function customize( Builder $instance ) |
107 | 111 | { |
108 | - if( !array_key_exists( $instance->tag, $this->fields ))return; |
|
112 | + if( !array_key_exists( $instance->tag, $this->fields )) { |
|
113 | + return; |
|
114 | + } |
|
109 | 115 | $args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' )); |
110 | 116 | $key = $instance->tag.'_'.$args['type']; |
111 | 117 | $classes = !isset( $this->fields[$key] ) |
@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | foreach( array_keys( $ipAddresses ) as $version ) { |
21 | 21 | $url = 'https://www.cloudflare.com/ips-'.$version; |
22 | 22 | $response = wp_remote_get( $url ); |
23 | - if( is_wp_error( $response )) { |
|
23 | + if( is_wp_error( $response ) ) { |
|
24 | 24 | glsr_log()->error( $response->get_error_message() ); |
25 | 25 | continue; |
26 | 26 | } |
27 | - if(( $statusCode = wp_remote_retrieve_response_code( $response )) != '200' ) { |
|
27 | + if( ($statusCode = wp_remote_retrieve_response_code( $response )) != '200' ) { |
|
28 | 28 | glsr_log()->error( 'Unable to connect to '.$url.' ['.$statusCode.']' ); |
29 | 29 | continue; |
30 | 30 | } |
31 | 31 | $ipAddresses[$version] = array_filter( |
32 | - (array)preg_split( '/\R/', wp_remote_retrieve_body( $response )) |
|
32 | + (array)preg_split( '/\R/', wp_remote_retrieve_body( $response ) ) |
|
33 | 33 | ); |
34 | 34 | } |
35 | 35 | set_transient( Application::ID.'_cloudflare_ips', $ipAddresses, static::EXPIRY_TIME ); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if( $test === false ) { |
65 | 65 | $response = wp_remote_post( 'https://api.wordpress.org/stats/php/1.0/' ); |
66 | 66 | $test = !is_wp_error( $response ) |
67 | - && in_array( $response['response']['code'], range( 200, 299 )) |
|
67 | + && in_array( $response['response']['code'], range( 200, 299 ) ) |
|
68 | 68 | ? 'Works' |
69 | 69 | : 'Does not work'; |
70 | 70 | set_transient( Application::ID.'_remote_post_test', $test, static::EXPIRY_TIME ); |