@@ -60,7 +60,9 @@ discard block |
||
| 60 | 60 | public function catchFatalError() |
| 61 | 61 | { |
| 62 | 62 | $error = error_get_last(); |
| 63 | - if( $error['type'] !== E_ERROR )return; |
|
| 63 | + if( $error['type'] !== E_ERROR ) { |
|
| 64 | + return; |
|
| 65 | + } |
|
| 64 | 66 | glsr_log()->error( $error['message'] ); |
| 65 | 67 | } |
| 66 | 68 | |
@@ -204,7 +206,9 @@ discard block |
||
| 204 | 206 | */ |
| 205 | 207 | public function scheduleCronJob() |
| 206 | 208 | { |
| 207 | - if( wp_next_scheduled( static::CRON_EVENT ))return; |
|
| 209 | + if( wp_next_scheduled( static::CRON_EVENT )) { |
|
| 210 | + return; |
|
| 211 | + } |
|
| 208 | 212 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); |
| 209 | 213 | } |
| 210 | 214 | |
@@ -235,7 +239,9 @@ discard block |
||
| 235 | 239 | || !in_array( plugin_basename( $this->file ), $data['plugins'] ) |
| 236 | 240 | || $data['action'] != 'update' |
| 237 | 241 | || $data['type'] != 'plugin' |
| 238 | - )return; |
|
| 242 | + ) { |
|
| 243 | + return; |
|
| 244 | + } |
|
| 239 | 245 | $this->upgrade(); |
| 240 | 246 | } |
| 241 | 247 | |
@@ -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' ); |