@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'results' => $this->buildResults(), |
61 | 61 | 'submit_button' => $this->buildSubmitButton().$this->buildRecaptcha(), |
62 | 62 | ], |
63 | - ]); |
|
63 | + ] ); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | $integration = glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ); |
72 | 72 | $recaptchaMethod = glsr( Helper::class )->buildMethodName( $integration, 'getRecaptcha' ); |
73 | - if( method_exists( $this, $recaptchaMethod )) { |
|
73 | + if( method_exists( $this, $recaptchaMethod ) ) { |
|
74 | 74 | return $this->$recaptchaMethod(); |
75 | 75 | } |
76 | 76 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | return glsr( Partial::class )->build( 'form-results', [ |
84 | 84 | 'errors' => $this->errors, |
85 | 85 | 'message' => $this->message, |
86 | - ]); |
|
86 | + ] ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'context' => [ |
96 | 96 | 'text' => __( 'Submit your review', 'site-reviews' ), |
97 | 97 | ], |
98 | - ]); |
|
98 | + ] ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $fields = array_merge( |
116 | 116 | $this->getHiddenFields(), |
117 | 117 | [$this->getHoneypotField()], |
118 | - $this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' )) |
|
118 | + $this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ) ) |
|
119 | 119 | ); |
120 | 120 | return $fields; |
121 | 121 | } |
@@ -128,27 +128,27 @@ discard block |
||
128 | 128 | $fields = [[ |
129 | 129 | 'name' => 'action', |
130 | 130 | 'value' => 'submit-review', |
131 | - ],[ |
|
131 | + ], [ |
|
132 | 132 | 'name' => 'assign_to', |
133 | 133 | 'value' => $this->args['assign_to'], |
134 | - ],[ |
|
134 | + ], [ |
|
135 | 135 | 'name' => 'category', |
136 | 136 | 'value' => $this->args['category'], |
137 | - ],[ |
|
137 | + ], [ |
|
138 | 138 | 'name' => 'excluded', |
139 | 139 | 'value' => $this->args['excluded'], // @todo should default to "[]" |
140 | - ],[ |
|
140 | + ], [ |
|
141 | 141 | 'name' => 'form_id', |
142 | 142 | 'value' => $this->args['id'], |
143 | - ],[ |
|
143 | + ], [ |
|
144 | 144 | 'name' => 'nonce', |
145 | 145 | 'value' => wp_create_nonce( 'submit-review' ), |
146 | - ],[ |
|
146 | + ], [ |
|
147 | 147 | 'name' => 'referer', |
148 | - 'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' )), |
|
148 | + 'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' ) ), |
|
149 | 149 | ]]; |
150 | 150 | return array_map( function( $field ) { |
151 | - return new Field( wp_parse_args( $field, ['type' => 'hidden'] )); |
|
151 | + return new Field( wp_parse_args( $field, ['type' => 'hidden'] ) ); |
|
152 | 152 | }, $fields ); |
153 | 153 | } |
154 | 154 | |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | */ |
158 | 158 | protected function getHoneypotField() |
159 | 159 | { |
160 | - return new Field([ |
|
160 | + return new Field( [ |
|
161 | 161 | 'name' => 'gotcha', |
162 | 162 | 'type' => 'honeypot', |
163 | - ]); |
|
163 | + ] ); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | */ |
169 | 169 | protected function getRecaptchaCustom() |
170 | 170 | { |
171 | - return glsr( Builder::class )->div([ |
|
171 | + return glsr( Builder::class )->div( [ |
|
172 | 172 | 'class' => 'glsr-recaptcha-holder', |
173 | - 'data-badge' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' )), |
|
174 | - 'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' )), |
|
173 | + 'data-badge' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ) ), |
|
174 | + 'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' ) ), |
|
175 | 175 | 'data-size' => 'invisible', |
176 | - ]); |
|
176 | + ] ); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $html = ob_get_clean(); |
187 | 187 | return glsr( Builder::class )->div( $html, [ |
188 | 188 | 'class' => 'glsr-recaptcha-holder', |
189 | - ]); |
|
189 | + ] ); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | protected function normalizeFieldErrors( Field &$field ) |
196 | 196 | { |
197 | - if( !array_key_exists( $field->field['path'], $this->errors ))return; |
|
197 | + if( !array_key_exists( $field->field['path'], $this->errors ) )return; |
|
198 | 198 | $field->field['errors'] = $this->errors[$field->field['path']]; |
199 | 199 | } |
200 | 200 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | protected function normalizeFieldRequired( Field &$field ) |
205 | 205 | { |
206 | - if( !in_array( $field->field['path'], $this->required ))return; |
|
206 | + if( !in_array( $field->field['path'], $this->required ) )return; |
|
207 | 207 | $field->field['required'] = true; |
208 | 208 | } |
209 | 209 | |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | */ |
226 | 226 | protected function normalizeFieldValue( Field &$field ) |
227 | 227 | { |
228 | - if( !array_key_exists( $field->field['path'], $this->values ))return; |
|
229 | - if( in_array( $field->field['type'], ['radio', 'checkbox'] )) { |
|
228 | + if( !array_key_exists( $field->field['path'], $this->values ) )return; |
|
229 | + if( in_array( $field->field['type'], ['radio', 'checkbox'] ) ) { |
|
230 | 230 | $field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']]; |
231 | 231 | } |
232 | 232 | else { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public function __get( $key ) |
21 | 21 | { |
22 | - if( array_key_exists( $key, $this->values )) { |
|
22 | + if( array_key_exists( $key, $this->values ) ) { |
|
23 | 23 | return $this->values[$key]; |
24 | 24 | } |
25 | 25 | return ''; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->versions = wp_parse_args( $versions, array( |
31 | 31 | 'php' => static::MIN_PHP_VERSION, |
32 | 32 | 'wordpress' => static::MIN_WORDPRESS_VERSION, |
33 | - )); |
|
33 | + ) ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | if( $this->isValid() ) { |
42 | 42 | return true; |
43 | 43 | } |
44 | - add_action( 'activated_plugin', array( $this, 'deactivate' )); |
|
45 | - add_action( 'admin_notices', array( $this, 'deactivate' )); |
|
44 | + add_action( 'activated_plugin', array( $this, 'deactivate' ) ); |
|
45 | + add_action( 'admin_notices', array( $this, 'deactivate' ) ); |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | filter_input( INPUT_GET, 'plugin_status' ), |
138 | 138 | filter_input( INPUT_GET, 'paged' ), |
139 | 139 | filter_input( INPUT_GET, 's' ) |
140 | - ))); |
|
140 | + ) ) ); |
|
141 | 141 | exit; |
142 | 142 | } |
143 | 143 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | defined( 'WPINC' ) || die; |
20 | 20 | |
21 | -if( !class_exists( 'GL_Plugin_Check_v3' )) { |
|
21 | +if( !class_exists( 'GL_Plugin_Check_v3' ) ) { |
|
22 | 22 | require_once __DIR__.'/activate.php'; |
23 | 23 | } |
24 | 24 | if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return; |
@@ -27,6 +27,6 @@ discard block |
||
27 | 27 | |
28 | 28 | $app = new GeminiLabs\SiteReviews\Application; |
29 | 29 | $app->make( 'Provider' )->register( $app ); |
30 | -register_activation_hook( __FILE__, array( $app, 'activate' )); |
|
31 | -register_deactivation_hook( __FILE__, array( $app, 'deactivate' )); |
|
30 | +register_activation_hook( __FILE__, array( $app, 'activate' ) ); |
|
31 | +register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) ); |
|
32 | 32 | $app->init(); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 'is_valid' => true, |
27 | 27 | 'is_widget' => false, |
28 | 28 | 'path' => '', |
29 | - ]); |
|
29 | + ] ); |
|
30 | 30 | $this->normalize(); |
31 | 31 | } |
32 | 32 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | { |
46 | 46 | if( !$this->field['is_valid'] )return; |
47 | 47 | if( $this->field['is_raw'] ) { |
48 | - return glsr( Builder::class )->{$this->field['type']}( $this->field ); |
|
48 | + return glsr( Builder::class )->{$this->field['type']}($this->field); |
|
49 | 49 | } |
50 | 50 | if( !$this->field['is_setting'] ) { |
51 | 51 | return $this->buildField(); |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | 'context' => [ |
74 | 74 | 'class' => $this->getFieldClass(), |
75 | 75 | 'errors' => $this->getFieldErrors(), |
76 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
76 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
77 | 77 | ], |
78 | - ]); |
|
78 | + ] ); |
|
79 | 79 | return apply_filters( 'site-reviews/rendered/field', $field, $this->field['type'], $this->field ); |
80 | 80 | } |
81 | 81 | |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | return glsr( Template::class )->build( 'partials/form/table-row', [ |
88 | 88 | 'context' => [ |
89 | 89 | 'class' => $this->getFieldClass(), |
90 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
90 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
91 | 91 | 'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ), |
92 | 92 | ], |
93 | - ]); |
|
93 | + ] ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | protected function buildSettingMultiField() |
100 | 100 | { |
101 | 101 | $dependsOn = $this->getFieldDependsOn(); |
102 | - unset( $this->field['data-depends'] ); |
|
102 | + unset($this->field['data-depends']); |
|
103 | 103 | return glsr( Template::class )->build( 'partials/form/table-row-multiple', [ |
104 | 104 | 'context' => [ |
105 | 105 | 'class' => $this->getFieldClass(), |
106 | 106 | 'depends_on' => $dependsOn, |
107 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
107 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
108 | 108 | 'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ), |
109 | 109 | 'legend' => $this->field['legend'], |
110 | 110 | ], |
111 | - ]); |
|
111 | + ] ); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | protected function getFieldClass() |
118 | 118 | { |
119 | 119 | $classes = []; |
120 | - if( !empty( $this->field['errors'] )) { |
|
120 | + if( !empty($this->field['errors']) ) { |
|
121 | 121 | $classes[] = 'glsr-has-error'; |
122 | 122 | } |
123 | 123 | if( $this->field['is_hidden'] ) { |
124 | 124 | $classes[] = 'hidden'; |
125 | 125 | } |
126 | - if( !empty( $this->field['required'] )) { |
|
126 | + if( !empty($this->field['required']) ) { |
|
127 | 127 | $classes[] = 'glsr-required'; |
128 | 128 | } |
129 | 129 | return implode( ' ', $classes ); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function getFieldDependsOn() |
136 | 136 | { |
137 | - return !empty( $this->field['data-depends'] ) |
|
137 | + return !empty($this->field['data-depends']) |
|
138 | 138 | ? $this->field['data-depends'] |
139 | 139 | : ''; |
140 | 140 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | protected function getFieldErrors() |
146 | 146 | { |
147 | - if( empty( $this->field['errors'] ) || !is_array( $this->field['errors'] ))return; |
|
147 | + if( empty($this->field['errors']) || !is_array( $this->field['errors'] ) )return; |
|
148 | 148 | $errors = array_reduce( $this->field['errors'], function( $carry, $error ) { |
149 | 149 | return $carry.glsr( Builder::class )->span( $error, ['class' => 'glsr-field-error'] ); |
150 | 150 | }); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | 'context' => [ |
153 | 153 | 'errors' => $errors, |
154 | 154 | ], |
155 | - ]); |
|
155 | + ] ); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | 'name', 'type', |
176 | 176 | ]; |
177 | 177 | foreach( $requiredValues as $value ) { |
178 | - if( isset( $this->field[$value] ))continue; |
|
178 | + if( isset($this->field[$value]) )continue; |
|
179 | 179 | $missingValues[] = $value; |
180 | 180 | $this->field['is_valid'] = false; |
181 | 181 | } |
182 | - if( !empty( $missingValues )) { |
|
182 | + if( !empty($missingValues) ) { |
|
183 | 183 | glsr_log() |
184 | - ->warning( 'Field is missing: '.implode( ', ', $missingValues )) |
|
184 | + ->warning( 'Field is missing: '.implode( ', ', $missingValues ) ) |
|
185 | 185 | ->info( $this->field ); |
186 | 186 | } |
187 | 187 | return $this->field['is_valid']; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | if( !$this->isFieldValid() )return; |
196 | 196 | $this->field['path'] = $this->field['name']; |
197 | 197 | $className = glsr( Helper::class )->buildClassName( $this->field['type'], __NAMESPACE__.'\Fields' ); |
198 | - if( class_exists( $className )) { |
|
198 | + if( class_exists( $className ) ) { |
|
199 | 199 | $this->field = array_merge( |
200 | 200 | wp_parse_args( $this->field, $className::defaults() ), |
201 | 201 | $className::required() |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | protected function normalizeFieldId() |
212 | 212 | { |
213 | - if( isset( $this->field['id'] ) || $this->field['is_raw'] )return; |
|
213 | + if( isset($this->field['id']) || $this->field['is_raw'] )return; |
|
214 | 214 | $this->field['id'] = glsr( Helper::class )->convertPathToId( |
215 | 215 | $this->field['path'], |
216 | 216 | $this->getFieldPrefix() |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $this->errors = $args['errors']; |
22 | 22 | return glsr( Builder::class )->div( wpautop( $args['message'] ), [ |
23 | 23 | 'class' => $this->getClass(), |
24 | - ]); |
|
24 | + ] ); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | protected function getClass() |
31 | 31 | { |
32 | - $errorClass = !empty( $this->errors ) |
|
32 | + $errorClass = !empty($this->errors) |
|
33 | 33 | ? 'glsr-has-errors' |
34 | 34 | : ''; |
35 | 35 | return trim( 'glsr-form-messages '.$errorClass ); |
@@ -9,5 +9,5 @@ |
||
9 | 9 | */ |
10 | 10 | add_filter( 'sbp_exclude_defer_scripts', function( $scriptHandles ) { |
11 | 11 | $scriptHandles[] = 'site-reviews/google-recaptcha'; |
12 | - return array_keys( array_flip( $scriptHandles )); |
|
12 | + return array_keys( array_flip( $scriptHandles ) ); |
|
13 | 13 | }); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function routeAdminPostRequest() |
17 | 17 | { |
18 | 18 | $request = $this->getRequest(); |
19 | - if( !$this->isValidPostRequest( $request ))return; |
|
19 | + if( !$this->isValidPostRequest( $request ) )return; |
|
20 | 20 | check_admin_referer( $request['action'] ); |
21 | 21 | $this->routeRequest( 'admin', $request['action'], $request ); |
22 | 22 | } |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | { |
41 | 41 | if( is_admin() )return; |
42 | 42 | $request = $this->getRequest(); |
43 | - if( !$this->isValidPostRequest( $request ))return; |
|
44 | - if( !$this->isValidPublicNonce( $request ))return; |
|
43 | + if( !$this->isValidPostRequest( $request ) )return; |
|
44 | + if( !$this->isValidPublicNonce( $request ) )return; |
|
45 | 45 | $this->routeRequest( 'public', $request['action'], $request ); |
46 | 46 | } |
47 | 47 | |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | protected function checkAjaxNonce( array $request ) |
52 | 52 | { |
53 | 53 | if( !is_user_logged_in() )return; |
54 | - if( !isset( $request['nonce'] )) { |
|
54 | + if( !isset($request['nonce']) ) { |
|
55 | 55 | $this->sendAjaxError( 'The request is missing a nonce', $request ); |
56 | 56 | } |
57 | - if( !wp_verify_nonce( $request['nonce'], $request['action'] )) { |
|
57 | + if( !wp_verify_nonce( $request['nonce'], $request['action'] ) ) { |
|
58 | 58 | $this->sendAjaxError( 'The request failed the nonce check', $request, 403 ); |
59 | 59 | } |
60 | 60 | } |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | */ |
65 | 65 | protected function checkAjaxRequest( array $request ) |
66 | 66 | { |
67 | - if( !isset( $request['action'] )) { |
|
67 | + if( !isset($request['action']) ) { |
|
68 | 68 | $this->sendAjaxError( 'The request must include an action', $request ); |
69 | 69 | } |
70 | - if( empty( $request['ajax_request'] )) { |
|
70 | + if( empty($request['ajax_request']) ) { |
|
71 | 71 | $this->sendAjaxError( 'The request is invalid', $request ); |
72 | 72 | } |
73 | 73 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | return []; |
84 | 84 | } |
85 | 85 | $request = glsr( Helper::class )->filterInputArray( 'request' ); |
86 | - if( empty( $request )) { |
|
86 | + if( empty($request) ) { |
|
87 | 87 | $request = glsr( Helper::class )->filterInputArray( Application::ID ); |
88 | 88 | } |
89 | 89 | return $this->normalizeRequest( $request ); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | protected function isValidPostRequest( array $request = [] ) |
96 | 96 | { |
97 | - return !empty( $request['action'] ) && empty( $request['ajax_request'] ); |
|
97 | + return !empty($request['action']) && empty($request['ajax_request']); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | protected function isValidPublicNonce( array $request ) |
104 | 104 | { |
105 | - if( is_user_logged_in() && !wp_verify_nonce( $request['nonce'], $request['action'] )) { |
|
105 | + if( is_user_logged_in() && !wp_verify_nonce( $request['nonce'], $request['action'] ) ) { |
|
106 | 106 | glsr_log()->error( 'Nonce check failed for public request' )->info( $request ); |
107 | 107 | return false; |
108 | 108 | } |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | protected function routeRequest( $type, $action, array $request = [] ) |
132 | 132 | { |
133 | 133 | $actionHook = 'site-reviews/route/'.$type.'/request'; |
134 | - $controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' )); |
|
134 | + $controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ) ); |
|
135 | 135 | $method = glsr( Helper::class )->buildMethodName( $action, 'router' ); |
136 | 136 | $request = apply_filters( 'site-reviews/route/request', $request, $action, $type ); |
137 | 137 | do_action( $actionHook, $action, $request ); |
138 | - if( is_callable( [$controller, $method] )) { |
|
138 | + if( is_callable( [$controller, $method] ) ) { |
|
139 | 139 | call_user_func( [$controller, $method], $request ); |
140 | 140 | return; |
141 | 141 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | protected function sendAjaxError( $error, array $request, $statusCode = 400 ) |
153 | 153 | { |
154 | 154 | glsr_log()->error( $error )->info( $request ); |
155 | - wp_send_json_error([ |
|
155 | + wp_send_json_error( [ |
|
156 | 156 | 'message' => __( 'The form could not be submitted. Please notify the site administrator.', 'site-reviews' ), |
157 | 157 | 'error' => $error, |
158 | 158 | ], $statusCode ); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function routerChangeReviewStatus( array $request ) |
24 | 24 | { |
25 | - wp_send_json_success( $this->execute( new ChangeStatus( $request ))); |
|
25 | + wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) ); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | public function routerClearConsole() |
32 | 32 | { |
33 | 33 | glsr( AdminController::class )->routerClearConsole(); |
34 | - wp_send_json_success([ |
|
34 | + wp_send_json_success( [ |
|
35 | 35 | 'console' => glsr( Console::class )->get(), |
36 | 36 | 'notices' => glsr( Notice::class )->get(), |
37 | - ]); |
|
37 | + ] ); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | { |
45 | 45 | $shortcode = $request['shortcode']; |
46 | 46 | $response = false; |
47 | - if( array_key_exists( $shortcode, glsr()->mceShortcodes )) { |
|
47 | + if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) { |
|
48 | 48 | $data = glsr()->mceShortcodes[$shortcode]; |
49 | - if( !empty( $data['errors'] )) { |
|
49 | + if( !empty($data['errors']) ) { |
|
50 | 50 | $data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )]; |
51 | 51 | } |
52 | 52 | $response = [ |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | public function routerSearchPosts( array $request ) |
67 | 67 | { |
68 | 68 | $results = glsr( Database::class )->searchPosts( $request['search'] ); |
69 | - wp_send_json_success([ |
|
69 | + wp_send_json_success( [ |
|
70 | 70 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
71 | 71 | 'items' => $results, |
72 | - ]); |
|
72 | + ] ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function routerSearchTranslations( array $request ) |
79 | 79 | { |
80 | - if( empty( $request['exclude'] )) { |
|
80 | + if( empty($request['exclude']) ) { |
|
81 | 81 | $request['exclude'] = []; |
82 | 82 | } |
83 | 83 | $results = glsr( Translator::class ) |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | ->exclude() |
86 | 86 | ->exclude( $request['exclude'] ) |
87 | 87 | ->renderResults(); |
88 | - wp_send_json_success([ |
|
88 | + wp_send_json_success( [ |
|
89 | 89 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
90 | 90 | 'items' => $results, |
91 | - ]); |
|
91 | + ] ); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | 'message' => glsr( Session::class )->get( $request['form_id'].'message', '', true ), |
103 | 103 | 'recaptcha' => glsr( Session::class )->get( $request['form_id'].'recaptcha', false, true ), |
104 | 104 | ]; |
105 | - if( !wp_validate_boolean( $data['errors'] )) { |
|
105 | + if( !wp_validate_boolean( $data['errors'] ) ) { |
|
106 | 106 | wp_send_json_success( $data ); |
107 | 107 | } |
108 | 108 | wp_send_json_error( $data ); |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function routerTogglePinned( array $request ) |
115 | 115 | { |
116 | - $isPinned = $this->execute( new TogglePinned( $request )); |
|
117 | - wp_send_json_success([ |
|
116 | + $isPinned = $this->execute( new TogglePinned( $request ) ); |
|
117 | + wp_send_json_success( [ |
|
118 | 118 | 'notices' => glsr( Notice::class )->get(), |
119 | 119 | 'pinned' => $isPinned, |
120 | - ]); |
|
120 | + ] ); |
|
121 | 121 | } |
122 | 122 | } |