@@ -47,7 +47,9 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | public function enqueueRecaptchaScript() |
| 49 | 49 | { |
| 50 | - if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' )return; |
|
| 50 | + if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' ) { |
|
| 51 | + return; |
|
| 52 | + } |
|
| 51 | 53 | wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
| 52 | 54 | 'hl' => apply_filters( 'site-reviews/recaptcha/language', get_locale() ), |
| 53 | 55 | 'onload' => 'glsr_render_recaptcha', |
@@ -22,7 +22,8 @@ |
||
| 22 | 22 | protected $public; |
| 23 | 23 | protected $translator; |
| 24 | 24 | |
| 25 | - public function __construct( Application $app ) { |
|
| 25 | + public function __construct( Application $app ) |
|
| 26 | + { |
|
| 26 | 27 | $this->app = $app; |
| 27 | 28 | $this->admin = $app->make( AdminController::class ); |
| 28 | 29 | $this->basename = plugin_basename( $app->file ); |
@@ -25,7 +25,8 @@ |
||
| 25 | 25 | protected $router; |
| 26 | 26 | protected $settings; |
| 27 | 27 | |
| 28 | - public function __construct( Application $app ) { |
|
| 28 | + public function __construct( Application $app ) |
|
| 29 | + { |
|
| 29 | 30 | $this->app = $app; |
| 30 | 31 | $this->admin = $app->make( AdminController::class ); |
| 31 | 32 | $this->editor = $app->make( EditorController::class ); |
@@ -171,8 +171,12 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | protected function validateAkismet() |
| 173 | 173 | { |
| 174 | - if( !empty( $this->error ))return; |
|
| 175 | - if( !glsr( Akismet::class )->isSpam( $this->request ))return; |
|
| 174 | + if( !empty( $this->error )) { |
|
| 175 | + return; |
|
| 176 | + } |
|
| 177 | + if( !glsr( Akismet::class )->isSpam( $this->request )) { |
|
| 178 | + return; |
|
| 179 | + } |
|
| 176 | 180 | $this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' ); |
| 177 | 181 | $this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' ); |
| 178 | 182 | } |
@@ -182,8 +186,12 @@ discard block |
||
| 182 | 186 | */ |
| 183 | 187 | protected function validateBlacklist() |
| 184 | 188 | { |
| 185 | - if( !empty( $this->error ))return; |
|
| 186 | - if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return; |
|
| 189 | + if( !empty( $this->error )) { |
|
| 190 | + return; |
|
| 191 | + } |
|
| 192 | + if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) { |
|
| 193 | + return; |
|
| 194 | + } |
|
| 187 | 195 | $blacklistAction = glsr( OptionManager::class )->get( 'settings.submissions.blacklist.action' ); |
| 188 | 196 | if( $blacklistAction == 'unapprove' ) { |
| 189 | 197 | $this->request['blacklisted'] = true; |
@@ -199,9 +207,13 @@ discard block |
||
| 199 | 207 | */ |
| 200 | 208 | protected function validateCustom() |
| 201 | 209 | { |
| 202 | - if( !empty( $this->error ))return; |
|
| 210 | + if( !empty( $this->error )) { |
|
| 211 | + return; |
|
| 212 | + } |
|
| 203 | 213 | $validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request ); |
| 204 | - if( $validated === true )return; |
|
| 214 | + if( $validated === true ) { |
|
| 215 | + return; |
|
| 216 | + } |
|
| 205 | 217 | $this->setSessionValues( 'errors', [] ); |
| 206 | 218 | $this->setSessionValues( 'values', $this->request ); |
| 207 | 219 | $this->error = is_string( $validated ) |
@@ -214,8 +226,12 @@ discard block |
||
| 214 | 226 | */ |
| 215 | 227 | protected function validateHoneyPot() |
| 216 | 228 | { |
| 217 | - if( !empty( $this->error ))return; |
|
| 218 | - if( empty( $this->request['gotcha'] ))return; |
|
| 229 | + if( !empty( $this->error )) { |
|
| 230 | + return; |
|
| 231 | + } |
|
| 232 | + if( empty( $this->request['gotcha'] )) { |
|
| 233 | + return; |
|
| 234 | + } |
|
| 219 | 235 | $this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' ); |
| 220 | 236 | $this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' ); |
| 221 | 237 | } |
@@ -225,7 +241,9 @@ discard block |
||
| 225 | 241 | */ |
| 226 | 242 | protected function validateRecaptcha() |
| 227 | 243 | { |
| 228 | - if( !empty( $this->error ))return; |
|
| 244 | + if( !empty( $this->error )) { |
|
| 245 | + return; |
|
| 246 | + } |
|
| 229 | 247 | $isValid = $this->isRecaptchaResponseValid(); |
| 230 | 248 | if( is_null( $isValid )) { |
| 231 | 249 | $this->setSessionValues( 'recaptcha', true ); |