@@ -18,7 +18,7 @@ |
||
18 | 18 | 'avatar' => '', |
19 | 19 | 'content' => '', |
20 | 20 | 'custom' => '', |
21 | - 'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' )), |
|
21 | + 'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' ) ), |
|
22 | 22 | 'email' => '', |
23 | 23 | 'ip_address' => glsr( Helper::class )->getIpAddress(), |
24 | 24 | 'pinned' => false, |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function callbackRegisterSettings( $input ) |
19 | 19 | { |
20 | - if( !is_array( $input )) { |
|
20 | + if( !is_array( $input ) ) { |
|
21 | 21 | $input = ['settings' => []]; |
22 | 22 | } |
23 | 23 | if( key( $input ) == 'settings' ) { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $options = $this->sanitizeGeneral( $input, $options ); |
26 | 26 | $options = $this->sanitizeSubmissions( $input, $options ); |
27 | 27 | $options = $this->sanitizeTranslations( $input, $options ); |
28 | - glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' )); |
|
28 | + glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) ); |
|
29 | 29 | return $options; |
30 | 30 | } |
31 | 31 | return $input; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [ |
41 | 41 | 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
42 | - ]); |
|
42 | + ] ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | if( $inputForm['support']['polylang'] == 'yes' ) { |
52 | 52 | if( !glsr( Polylang::class )->isActive() ) { |
53 | 53 | $options['settings']['general']['support']['polylang'] = 'no'; |
54 | - glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' )); |
|
54 | + glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ) ); |
|
55 | 55 | } |
56 | 56 | else if( !glsr( Polylang::class )->isSupported() ) { |
57 | 57 | $options['settings']['general']['support']['polylang'] = 'no'; |
58 | - glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' )); |
|
58 | + glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ) ); |
|
59 | 59 | } |
60 | 60 | } |
61 | - if( !isset( $inputForm['notifications'] )) { |
|
61 | + if( !isset($inputForm['notifications']) ) { |
|
62 | 62 | $options['settings']['general']['notifications'] = []; |
63 | 63 | } |
64 | 64 | if( trim( $inputForm['notification_message'] ) == '' ) { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | protected function sanitizeSubmissions( array $input, array $options ) |
74 | 74 | { |
75 | 75 | $inputForm = $input['settings']['submissions']; |
76 | - if( !isset( $inputForm['required'] )) { |
|
76 | + if( !isset($inputForm['required']) ) { |
|
77 | 77 | $options['settings']['submissions']['required'] = []; |
78 | 78 | } |
79 | 79 | return $options; |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function sanitizeTranslations( array $input, array $options ) |
86 | 86 | { |
87 | - if( isset( $input['settings']['strings'] )) { |
|
88 | - $options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] )); |
|
87 | + if( isset($input['settings']['strings']) ) { |
|
88 | + $options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) ); |
|
89 | 89 | $allowedTags = ['a' => ['class' => [], 'href' => [], 'target' => []]]; |
90 | - array_walk( $options['settings']['strings'], function( &$string ) use( $allowedTags ) { |
|
91 | - if( isset( $string['s2'] )) { |
|
90 | + array_walk( $options['settings']['strings'], function( &$string ) use($allowedTags) { |
|
91 | + if( isset($string['s2']) ) { |
|
92 | 92 | $string['s2'] = wp_kses( $string['s2'], $allowedTags ); |
93 | 93 | } |
94 | - if( isset( $string['p2'] )) { |
|
94 | + if( isset($string['p2']) ) { |
|
95 | 95 | $string['p2'] = wp_kses( $string['p2'], $allowedTags ); |
96 | 96 | } |
97 | 97 | }); |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | $review = glsr( ReviewManager::class )->create( $command ); |
18 | 18 | if( !$review ) { |
19 | 19 | glsr( Session::class )->set( $command->form_id.'errors', [] ); |
20 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' )); |
|
20 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ) ); |
|
21 | 21 | return; |
22 | 22 | } |
23 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
|
23 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ) ); |
|
24 | 24 | glsr( Notification::class )->send( $review ); |
25 | 25 | if( $command->ajax_request )return; |
26 | - wp_safe_redirect( $this->getReferer( $command )); |
|
26 | + wp_safe_redirect( $this->getReferer( $command ) ); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected function getReferer( Command $command ) |
34 | 34 | { |
35 | - $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ))); |
|
36 | - if( empty( $referer )) { |
|
35 | + $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
36 | + if( empty($referer) ) { |
|
37 | 37 | $referer = $command->referer; |
38 | 38 | } |
39 | - if( empty( $referer )) { |
|
39 | + if( empty($referer) ) { |
|
40 | 40 | glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command ); |
41 | 41 | $referer = home_url(); |
42 | 42 | } |
@@ -22,7 +22,9 @@ |
||
22 | 22 | } |
23 | 23 | glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
24 | 24 | glsr( Notification::class )->send( $review ); |
25 | - if( $command->ajax_request )return; |
|
25 | + if( $command->ajax_request ) { |
|
26 | + return; |
|
27 | + } |
|
26 | 28 | wp_safe_redirect( $this->getReferer( $command )); |
27 | 29 | exit; |
28 | 30 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $fields = []; |
30 | 30 | foreach( glsr()->config( 'forms/'.$id ) as $name => $field ) { |
31 | - $fields[] = new Field( wp_parse_args( $field, ['name' => $name] )); |
|
31 | + $fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) ); |
|
32 | 32 | } |
33 | 33 | return $fields; |
34 | 34 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $this->validateBlacklist(); |
62 | 62 | $this->validateAkismet(); |
63 | 63 | $this->validateRecaptcha(); |
64 | - if( !empty( $this->error )) { |
|
64 | + if( !empty($this->error) ) { |
|
65 | 65 | $this->setSessionValues( 'message', $this->error ); |
66 | 66 | } |
67 | 67 | return $this; |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | { |
85 | 85 | $rules = array_intersect_key( |
86 | 86 | apply_filters( 'site-reviews/validation/rules', static::VALIDATION_RULES ), |
87 | - array_flip( $this->getOption( 'settings.submissions.required', [] )) |
|
87 | + array_flip( $this->getOption( 'settings.submissions.required', [] ) ) |
|
88 | 88 | ); |
89 | - $excluded = isset( $request['excluded'] ) |
|
89 | + $excluded = isset($request['excluded']) |
|
90 | 90 | ? (array)json_decode( $request['excluded'] ) |
91 | 91 | : []; |
92 | - return array_diff_key( $rules, array_flip( $excluded )); |
|
92 | + return array_diff_key( $rules, array_flip( $excluded ) ); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) { |
101 | 101 | return true; |
102 | 102 | } |
103 | - if( empty( $this->request['recaptcha-token'] )) { |
|
103 | + if( empty($this->request['recaptcha-token']) ) { |
|
104 | 104 | return null; // @see $this->validateRecaptcha() |
105 | 105 | } |
106 | 106 | return $this->isRecaptchaValid( $this->request['recaptcha-token'] ); |
@@ -112,17 +112,17 @@ discard block |
||
112 | 112 | */ |
113 | 113 | protected function isRecaptchaValid( $recaptchaToken ) |
114 | 114 | { |
115 | - $endpoint = add_query_arg([ |
|
115 | + $endpoint = add_query_arg( [ |
|
116 | 116 | 'remoteip' => glsr( Helper::class )->getIpAddress(), |
117 | 117 | 'response' => $recaptchaToken, |
118 | 118 | 'secret' => $this->getOption( 'settings.submissions.recaptcha.secret' ), |
119 | 119 | ], static::RECAPTCHA_ENDPOINT ); |
120 | - if( is_wp_error( $response = wp_remote_get( $endpoint ))) { |
|
120 | + if( is_wp_error( $response = wp_remote_get( $endpoint ) ) ) { |
|
121 | 121 | glsr_log()->error( $response->get_error_message() ); |
122 | 122 | return false; |
123 | 123 | } |
124 | - $response = json_decode( wp_remote_retrieve_body( $response )); |
|
125 | - if( !empty( $response->success )) { |
|
124 | + $response = json_decode( wp_remote_retrieve_body( $response ) ); |
|
125 | + if( !empty($response->success) ) { |
|
126 | 126 | return boolval( $response->success ); |
127 | 127 | } |
128 | 128 | foreach( $response->{'error-codes'} as $error ) { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | { |
139 | 139 | $rules = $this->getValidationRules( $request ); |
140 | 140 | $errors = glsr( Validator::class )->validate( $request, $rules ); |
141 | - if( empty( $errors )) { |
|
141 | + if( empty($errors) ) { |
|
142 | 142 | return true; |
143 | 143 | } |
144 | 144 | $this->setSessionValues( 'errors', $errors ); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | protected function setSessionValues( $type, $value, $loggedMessage = '' ) |
156 | 156 | { |
157 | 157 | glsr( Session::class )->set( $this->form_id.$type, $value ); |
158 | - if( !empty( $loggedMessage )) { |
|
158 | + if( !empty($loggedMessage) ) { |
|
159 | 159 | glsr_log()->warning( $loggedMessage ); |
160 | 160 | glsr_log()->warning( $this->request ); |
161 | 161 | } |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | */ |
167 | 167 | protected function validateAkismet() |
168 | 168 | { |
169 | - if( !empty( $this->error ))return; |
|
170 | - if( !glsr( Akismet::class )->isSpam( $this->request ))return; |
|
169 | + if( !empty($this->error) )return; |
|
170 | + if( !glsr( Akismet::class )->isSpam( $this->request ) )return; |
|
171 | 171 | $this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' ); |
172 | 172 | $this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' ); |
173 | 173 | } |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | */ |
178 | 178 | protected function validateBlacklist() |
179 | 179 | { |
180 | - if( !empty( $this->error ))return; |
|
181 | - if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return; |
|
180 | + if( !empty($this->error) )return; |
|
181 | + if( !glsr( Blacklist::class )->isBlacklisted( $this->request ) )return; |
|
182 | 182 | $blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' ); |
183 | 183 | if( $blacklistAction == 'reject' ) { |
184 | 184 | $this->setSessionValues( 'errors', [], 'Blacklisted submission detected:' ); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | protected function validateCustom() |
195 | 195 | { |
196 | - if( !empty( $this->error ))return; |
|
196 | + if( !empty($this->error) )return; |
|
197 | 197 | $validated = apply_filters( 'site-reviews/validate/custom', true, $this->request ); |
198 | 198 | if( $validated === true )return; |
199 | 199 | $this->setSessionValues( 'errors', [] ); |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | */ |
209 | 209 | protected function validateHoneyPot() |
210 | 210 | { |
211 | - if( !empty( $this->error ))return; |
|
212 | - if( empty( $this->request['gotcha'] ))return; |
|
211 | + if( !empty($this->error) )return; |
|
212 | + if( empty($this->request['gotcha']) )return; |
|
213 | 213 | $this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' ); |
214 | 214 | $this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' ); |
215 | 215 | } |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | */ |
220 | 220 | protected function validateRecaptcha() |
221 | 221 | { |
222 | - if( !empty( $this->error ))return; |
|
222 | + if( !empty($this->error) )return; |
|
223 | 223 | $isValid = $this->isRecaptchaResponseValid(); |
224 | - if( is_null( $isValid )) { |
|
224 | + if( is_null( $isValid ) ) { |
|
225 | 225 | $this->setSessionValues( 'recaptcha', 'unset' ); |
226 | 226 | $this->recaptchaIsUnset = true; |
227 | 227 | } |
@@ -237,11 +237,11 @@ discard block |
||
237 | 237 | */ |
238 | 238 | protected function validateRequest( array $request ) |
239 | 239 | { |
240 | - if( !$this->isRequestValid( $request )) { |
|
240 | + if( !$this->isRequestValid( $request ) ) { |
|
241 | 241 | $this->error = __( 'Please fix the submission errors.', 'site-reviews' ); |
242 | 242 | return $request; |
243 | 243 | } |
244 | - if( empty( $request['title'] )) { |
|
244 | + if( empty($request['title']) ) { |
|
245 | 245 | $request['title'] = __( 'No Title', 'site-reviews' ); |
246 | 246 | } |
247 | 247 | return array_merge( glsr( ValidateReviewDefaults::class )->defaults(), $request ); |
@@ -166,8 +166,12 @@ discard block |
||
166 | 166 | */ |
167 | 167 | protected function validateAkismet() |
168 | 168 | { |
169 | - if( !empty( $this->error ))return; |
|
170 | - if( !glsr( Akismet::class )->isSpam( $this->request ))return; |
|
169 | + if( !empty( $this->error )) { |
|
170 | + return; |
|
171 | + } |
|
172 | + if( !glsr( Akismet::class )->isSpam( $this->request )) { |
|
173 | + return; |
|
174 | + } |
|
171 | 175 | $this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' ); |
172 | 176 | $this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' ); |
173 | 177 | } |
@@ -177,8 +181,12 @@ discard block |
||
177 | 181 | */ |
178 | 182 | protected function validateBlacklist() |
179 | 183 | { |
180 | - if( !empty( $this->error ))return; |
|
181 | - if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return; |
|
184 | + if( !empty( $this->error )) { |
|
185 | + return; |
|
186 | + } |
|
187 | + if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) { |
|
188 | + return; |
|
189 | + } |
|
182 | 190 | $blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' ); |
183 | 191 | if( $blacklistAction == 'reject' ) { |
184 | 192 | $this->setSessionValues( 'errors', [], 'Blacklisted submission detected:' ); |
@@ -193,9 +201,13 @@ discard block |
||
193 | 201 | */ |
194 | 202 | protected function validateCustom() |
195 | 203 | { |
196 | - if( !empty( $this->error ))return; |
|
204 | + if( !empty( $this->error )) { |
|
205 | + return; |
|
206 | + } |
|
197 | 207 | $validated = apply_filters( 'site-reviews/validate/custom', true, $this->request ); |
198 | - if( $validated === true )return; |
|
208 | + if( $validated === true ) { |
|
209 | + return; |
|
210 | + } |
|
199 | 211 | $this->setSessionValues( 'errors', [] ); |
200 | 212 | $this->setSessionValues( 'values', $this->request ); |
201 | 213 | $this->error = is_string( $validated ) |
@@ -208,8 +220,12 @@ discard block |
||
208 | 220 | */ |
209 | 221 | protected function validateHoneyPot() |
210 | 222 | { |
211 | - if( !empty( $this->error ))return; |
|
212 | - if( empty( $this->request['gotcha'] ))return; |
|
223 | + if( !empty( $this->error )) { |
|
224 | + return; |
|
225 | + } |
|
226 | + if( empty( $this->request['gotcha'] )) { |
|
227 | + return; |
|
228 | + } |
|
213 | 229 | $this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' ); |
214 | 230 | $this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' ); |
215 | 231 | } |
@@ -219,7 +235,9 @@ discard block |
||
219 | 235 | */ |
220 | 236 | protected function validateRecaptcha() |
221 | 237 | { |
222 | - if( !empty( $this->error ))return; |
|
238 | + if( !empty( $this->error )) { |
|
239 | + return; |
|
240 | + } |
|
223 | 241 | $isValid = $this->isRecaptchaResponseValid(); |
224 | 242 | if( is_null( $isValid )) { |
225 | 243 | $this->setSessionValues( 'recaptcha', 'unset' ); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | // Database/ReviewManager.php |
6 | 6 | add_action( 'site-reviews/review/created', function( $review ) { |
7 | - if( has_action( 'site-reviews/local/review/create' )) { |
|
7 | + if( has_action( 'site-reviews/local/review/create' ) ) { |
|
8 | 8 | glsr()->deprecated[] = 'The "site-reviews/local/review/create" hook has been deprecated. Please use the "site-reviews/create/review" hook instead.'; |
9 | 9 | do_action( 'site-reviews/local/review/create', (array)get_post( $review->ID ), (array)$review, $review->ID ); |
10 | 10 | } |
@@ -12,18 +12,18 @@ discard block |
||
12 | 12 | |
13 | 13 | // Handlers/CreateReview.php |
14 | 14 | add_action( 'site-reviews/review/submitted', function( $review ) { |
15 | - if( has_action( 'site-reviews/local/review/submitted' )) { |
|
15 | + if( has_action( 'site-reviews/local/review/submitted' ) ) { |
|
16 | 16 | glsr()->deprecated[] = 'The "site-reviews/local/review/submitted" hook has been deprecated. Please use the "site-reviews/review/submitted" hook instead.'; |
17 | 17 | do_action( 'site-reviews/local/review/submitted', null, $review ); |
18 | 18 | } |
19 | - if( has_filter( 'site-reviews/local/review/submitted/message' )) { |
|
19 | + if( has_filter( 'site-reviews/local/review/submitted/message' ) ) { |
|
20 | 20 | glsr()->deprecated[] = 'The "site-reviews/local/review/submitted/message" hook has been deprecated.'; |
21 | 21 | } |
22 | 22 | }, 9 ); |
23 | 23 | |
24 | 24 | // Database/ReviewManager.php |
25 | 25 | add_filter( 'site-reviews/create/review-values', function( $values, $command ) { |
26 | - if( has_filter( 'site-reviews/local/review' )) { |
|
26 | + if( has_filter( 'site-reviews/local/review' ) ) { |
|
27 | 27 | glsr()->deprecated[] = 'The "site-reviews/local/review" hook has been deprecated. Please use the "site-reviews/create/review-values" hook instead.'; |
28 | 28 | return apply_filters( 'site-reviews/local/review', $values, $command ); |
29 | 29 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | // Handlers/EnqueuePublicAssets.php |
34 | 34 | add_filter( 'site-reviews/enqueue/public/localize', function( $variables ) { |
35 | - if( has_filter( 'site-reviews/enqueue/localize' )) { |
|
35 | + if( has_filter( 'site-reviews/enqueue/localize' ) ) { |
|
36 | 36 | glsr()->deprecated[] = 'The "site-reviews/enqueue/localize" hook has been deprecated. Please use the "site-reviews/enqueue/public/localize" hook instead.'; |
37 | 37 | return apply_filters( 'site-reviews/enqueue/localize', $variables ); |
38 | 38 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | // Modules/Rating.php |
43 | 43 | add_filter( 'site-reviews/rating/average', function( $average ) { |
44 | - if( has_filter( 'site-reviews/average/rating' )) { |
|
44 | + if( has_filter( 'site-reviews/average/rating' ) ) { |
|
45 | 45 | glsr()->deprecated[] = 'The "site-reviews/average/rating" hook has been deprecated. Please use the "site-reviews/rating/average" hook instead.'; |
46 | 46 | } |
47 | 47 | return $average; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | // Modules/Rating.php |
51 | 51 | add_filter( 'site-reviews/rating/ranking', function( $ranking ) { |
52 | - if( has_filter( 'site-reviews/bayesian/ranking' )) { |
|
52 | + if( has_filter( 'site-reviews/bayesian/ranking' ) ) { |
|
53 | 53 | glsr()->deprecated[] = 'The "site-reviews/bayesian/ranking" hook has been deprecated. Please use the "site-reviews/rating/ranking" hook instead.'; |
54 | 54 | } |
55 | 55 | return $ranking; |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | |
58 | 58 | // Modules/Html/Partials/SiteReviews.php |
59 | 59 | add_filter( 'site-reviews/review/build/after', function( $renderedFields ) { |
60 | - if( has_filter( 'site-reviews/reviews/review/text' )) { |
|
60 | + if( has_filter( 'site-reviews/reviews/review/text' ) ) { |
|
61 | 61 | glsr()->deprecated[] = 'The "site-reviews/reviews/review/text" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.'; |
62 | 62 | } |
63 | - if( has_filter( 'site-reviews/reviews/review/title' )) { |
|
63 | + if( has_filter( 'site-reviews/reviews/review/title' ) ) { |
|
64 | 64 | glsr()->deprecated[] = 'The "site-reviews/reviews/review/title" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.'; |
65 | 65 | } |
66 | 66 | return $renderedFields; |
@@ -68,26 +68,26 @@ discard block |
||
68 | 68 | |
69 | 69 | // Modules/Html/Partials/SiteReviews.php |
70 | 70 | add_filter( 'site-reviews/review/build/before', function( $review ) { |
71 | - if( has_filter( 'site-reviews/rendered/review' )) { |
|
71 | + if( has_filter( 'site-reviews/rendered/review' ) ) { |
|
72 | 72 | glsr()->deprecated[] = 'The "site-reviews/rendered/review" hook has been deprecated. Please either use a custom "review.php" template (refer to the documentation), or use the "site-reviews/review/build/after" hook instead.'; |
73 | 73 | } |
74 | - if( has_filter( 'site-reviews/rendered/review/meta/order' )) { |
|
74 | + if( has_filter( 'site-reviews/rendered/review/meta/order' ) ) { |
|
75 | 75 | glsr()->deprecated[] = 'The "site-reviews/rendered/review/meta/order" hook has been deprecated. Please use a custom "review.php" template instead (refer to the documentation).'; |
76 | 76 | } |
77 | - if( has_filter( 'site-reviews/rendered/review/order' )) { |
|
77 | + if( has_filter( 'site-reviews/rendered/review/order' ) ) { |
|
78 | 78 | glsr()->deprecated[] = 'The "site-reviews/rendered/review/order" hook has been deprecated. Please use a custom "review.php" template instead (refer to the documentation).'; |
79 | 79 | } |
80 | - if( has_filter( 'site-reviews/rendered/review-form/login-register' )) { |
|
80 | + if( has_filter( 'site-reviews/rendered/review-form/login-register' ) ) { |
|
81 | 81 | glsr()->deprecated[] = 'The "site-reviews/rendered/review-form/login-register" hook has been deprecated. Please use a custom "login-register.php" template instead (refer to the documentation).'; |
82 | 82 | } |
83 | - if( has_filter( 'site-reviews/reviews/navigation_links' )) { |
|
83 | + if( has_filter( 'site-reviews/reviews/navigation_links' ) ) { |
|
84 | 84 | glsr()->deprecated[] = 'The "site-reviews/reviews/navigation_links" hook has been deprecated. Please use a custom "pagination.php" template instead (refer to the documentation).'; |
85 | 85 | } |
86 | 86 | return $review; |
87 | 87 | }, 9 ); |
88 | 88 | |
89 | 89 | add_filter( 'site-reviews/validate/custom', function( $result, $request ) { |
90 | - if( has_filter( 'site-reviews/validate/review/submission' )) { |
|
90 | + if( has_filter( 'site-reviews/validate/review/submission' ) ) { |
|
91 | 91 | glsr_log()->notice( 'The "site-reviews/validate/review/submission" hook has been deprecated. Please use the "site-reviews/validate/custom" hook instead.' ); |
92 | 92 | return apply_filters( 'site-reviews/validate/review/submission', $result, $request ); |
93 | 93 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | }, 9, 2 ); |
96 | 96 | |
97 | 97 | add_filter( 'site-reviews/views/file', function( $file, $view, $data ) { |
98 | - if( has_filter( 'site-reviews/addon/views/file' )) { |
|
98 | + if( has_filter( 'site-reviews/addon/views/file' ) ) { |
|
99 | 99 | glsr()->deprecated[] = 'The "site-reviews/addon/views/file" hook has been deprecated. Please use the "site-reviews/views/file" hook instead.'; |
100 | 100 | $file = apply_filters( 'site-reviews/addon/views/file', $file, $view, $data ); |
101 | 101 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | }, 9, 3 ); |
104 | 104 | |
105 | 105 | add_action( 'wp_footer', function() { |
106 | - $notices = array_keys( array_flip( glsr()->deprecated )); |
|
106 | + $notices = array_keys( array_flip( glsr()->deprecated ) ); |
|
107 | 107 | natsort( $notices ); |
108 | 108 | foreach( $notices as $notice ) { |
109 | 109 | glsr_log()->notice( $notice ); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | <p>{{ data.s1 }}</p> |
8 | 8 | </div> |
9 | 9 | <p class="row-actions"> |
10 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
10 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
11 | 11 | </p> |
12 | 12 | </td> |
13 | 13 | <td class="glsr-string-td2"> |
@@ -8,7 +8,7 @@ |
||
8 | 8 | <p>{{ data.p1 }}</p> |
9 | 9 | </div> |
10 | 10 | <p class="row-actions"> |
11 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
11 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
12 | 12 | </p> |
13 | 13 | </td> |
14 | 14 | <td class="glsr-string-td2"> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | { |
19 | 19 | return $this->translate( $translation, $domain, [ |
20 | 20 | 'single' => $text, |
21 | - ]); |
|
21 | + ] ); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | return $this->translate( $translation, $domain, [ |
34 | 34 | 'context' => $context, |
35 | 35 | 'single' => $text, |
36 | - ]); |
|
36 | + ] ); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'number' => $number, |
51 | 51 | 'plural' => $plural, |
52 | 52 | 'single' => $single, |
53 | - ]); |
|
53 | + ] ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 'number' => $number, |
70 | 70 | 'plural' => $plural, |
71 | 71 | 'single' => $single, |
72 | - ]); |
|
72 | + ] ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | $args = $this->normalizeTranslationArgs( $args ); |
86 | 86 | $strings = $this->getTranslationStrings( $args['single'], $args['plural'] ); |
87 | - if( empty( $strings )) { |
|
87 | + if( empty($strings) ) { |
|
88 | 88 | return $original; |
89 | 89 | } |
90 | 90 | $string = current( $strings ); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | protected function getTranslationStrings( $single, $plural ) |
102 | 102 | { |
103 | - return array_filter( glsr( Translation::class )->translations(), function( $string ) use( $single, $plural ) { |
|
103 | + return array_filter( glsr( Translation::class )->translations(), function( $string ) use($single, $plural) { |
|
104 | 104 | return $string['s1'] == html_entity_decode( $single, ENT_COMPAT, 'UTF-8' ) |
105 | 105 | && $string['p1'] == html_entity_decode( $plural, ENT_COMPAT, 'UTF-8' ); |
106 | 106 | }); |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | */ |
127 | 127 | protected function translatePlural( $domain, array $string, array $args ) |
128 | 128 | { |
129 | - if( !empty( $string['s2'] )) { |
|
129 | + if( !empty($string['s2']) ) { |
|
130 | 130 | $args['single'] = $string['s2']; |
131 | 131 | } |
132 | - if( !empty( $string['p2'] )) { |
|
132 | + if( !empty($string['p2']) ) { |
|
133 | 133 | $args['plural'] = $string['p2']; |
134 | 134 | } |
135 | 135 | return get_translations_for_domain( $domain )->translate_plural( |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | protected function translateSingle( $domain, array $string, array $args ) |
148 | 148 | { |
149 | - if( !empty( $string['s2'] )) { |
|
149 | + if( !empty($string['s2']) ) { |
|
150 | 150 | $args['single'] = $string['s2']; |
151 | 151 | } |
152 | 152 | return get_translations_for_domain( $domain )->translate( |