@@ -74,7 +74,9 @@ discard block |
||
74 | 74 | foreach( $this->rules as $attribute => $rules ) { |
75 | 75 | foreach( $rules as $rule ) { |
76 | 76 | $this->validateAttribute( $attribute, $rule ); |
77 | - if( $this->shouldStopValidating( $attribute ))break; |
|
77 | + if( $this->shouldStopValidating( $attribute )) { |
|
78 | + break; |
|
79 | + } |
|
78 | 80 | } |
79 | 81 | } |
80 | 82 | return $this->errors; |
@@ -90,7 +92,9 @@ discard block |
||
90 | 92 | public function validateAttribute( $attribute, $rule ) |
91 | 93 | { |
92 | 94 | list( $rule, $parameters ) = $this->parseRule( $rule ); |
93 | - if( $rule == '' )return; |
|
95 | + if( $rule == '' ) { |
|
96 | + return; |
|
97 | + } |
|
94 | 98 | $value = $this->getValue( $attribute ); |
95 | 99 | $this->validateRequired( $attribute, $value ) || in_array( $rule, $this->implicitRules ); |
96 | 100 | if( !method_exists( $this, $method = 'validate'.$rule )) { |
@@ -163,7 +167,9 @@ discard block |
||
163 | 167 | */ |
164 | 168 | protected function getRule( $attribute, $rules ) |
165 | 169 | { |
166 | - if( !array_key_exists( $attribute, $this->rules ))return; |
|
170 | + if( !array_key_exists( $attribute, $this->rules )) { |
|
171 | + return; |
|
172 | + } |
|
167 | 173 | $rules = (array) $rules; |
168 | 174 | foreach( $this->rules[$attribute] as $rule ) { |
169 | 175 | list( $rule, $parameters ) = $this->parseRule( $rule ); |
@@ -314,7 +320,9 @@ discard block |
||
314 | 320 | $message = isset( $strings[$key] ) |
315 | 321 | ? $strings[$key] |
316 | 322 | : false; |
317 | - if( !$message )return; |
|
323 | + if( !$message ) { |
|
324 | + return; |
|
325 | + } |
|
318 | 326 | $message = str_replace( ':attribute', $attribute, $message ); |
319 | 327 | if( method_exists( $this, $replacer = 'replace'.$rule )) { |
320 | 328 | $message = $this->$replacer( $message, $parameters ); |
@@ -190,7 +190,9 @@ |
||
190 | 190 | if( $index === false |
191 | 191 | || !isset( $caller[$index+2]['class'] ) |
192 | 192 | || !isset( $caller[$index+2]['function'] ) |
193 | - )return; |
|
193 | + ) { |
|
194 | + return; |
|
195 | + } |
|
194 | 196 | return sprintf( '[%s()->%s:%s] ', |
195 | 197 | $caller[$index+2]['class'], |
196 | 198 | $caller[$index+2]['function'], |
@@ -87,7 +87,9 @@ |
||
87 | 87 | */ |
88 | 88 | public function deactivate( $plugin ) |
89 | 89 | { |
90 | - if( static::isValid() )return; |
|
90 | + if( static::isValid() ) { |
|
91 | + return; |
|
92 | + } |
|
91 | 93 | $pluginSlug = plugin_basename( static::$file ); |
92 | 94 | if( $plugin == $pluginSlug ) { |
93 | 95 | $this->redirect(); //exit |
@@ -62,7 +62,9 @@ |
||
62 | 62 | if( !empty( $validated->error )) { |
63 | 63 | return $validated->request; |
64 | 64 | } |
65 | - if( $validated->recaptchaIsUnset )return; |
|
65 | + if( $validated->recaptchaIsUnset ) { |
|
66 | + return; |
|
67 | + } |
|
66 | 68 | return $this->execute( new CreateReview( $validated->request )); |
67 | 69 | } |
68 | 70 | } |
@@ -115,7 +115,9 @@ discard block |
||
115 | 115 | protected function sendNotification( $post_id, Command $command ) |
116 | 116 | { |
117 | 117 | $notificationType = glsr( OptionManager::class )->get( 'settings.general.notification' ); |
118 | - if( !in_array( $notificationType, ['default','custom','webhook'] ))return; |
|
118 | + if( !in_array( $notificationType, ['default','custom','webhook'] )) { |
|
119 | + return; |
|
120 | + } |
|
119 | 121 | $assignedToTitle = get_the_title( (int) $command->assignedTo ); |
120 | 122 | $notificationSubject = _nx( |
121 | 123 | 'New %s-star review', |
@@ -162,7 +164,9 @@ discard block |
||
162 | 164 | */ |
163 | 165 | protected function sendWebhookNotification( Command $command, array $args ) |
164 | 166 | { |
165 | - if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )))return; |
|
167 | + if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' ))) { |
|
168 | + return; |
|
169 | + } |
|
166 | 170 | $notification = $this->createWebhookNotification( $command, $args ); |
167 | 171 | $result = wp_remote_post( $endpoint, [ |
168 | 172 | 'method' => 'POST', |
@@ -57,9 +57,13 @@ discard block |
||
57 | 57 | protected function generateFields( array $fields ) |
58 | 58 | { |
59 | 59 | $generatedFields = array_map( function( $field ) { |
60 | - if( empty( $field ))return; |
|
60 | + if( empty( $field )) { |
|
61 | + return; |
|
62 | + } |
|
61 | 63 | $field = $this->normalize( $field ); |
62 | - if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return; |
|
64 | + if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ))) { |
|
65 | + return; |
|
66 | + } |
|
63 | 67 | return $this->$method( $field ); |
64 | 68 | }, $fields ); |
65 | 69 | return array_values( array_filter( $generatedFields )); |
@@ -74,7 +78,9 @@ discard block |
||
74 | 78 | if( !empty( $this->errors )) { |
75 | 79 | $errors = []; |
76 | 80 | foreach( $this->required as $name => $alert ) { |
77 | - if( false !== array_search( $name, array_column( $fields, 'name' )))continue; |
|
81 | + if( false !== array_search( $name, array_column( $fields, 'name' ))) { |
|
82 | + continue; |
|
83 | + } |
|
78 | 84 | $errors[] = $this->errors[$name]; |
79 | 85 | } |
80 | 86 | $this->errors = $errors; |
@@ -118,7 +124,9 @@ discard block |
||
118 | 124 | */ |
119 | 125 | protected function normalizeContainer( array $field ) |
120 | 126 | { |
121 | - if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return; |
|
127 | + if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field )) { |
|
128 | + return; |
|
129 | + } |
|
122 | 130 | $field['items'] = $this->generateFields( $field['items'] ); |
123 | 131 | return $field; |
124 | 132 | } |
@@ -128,7 +136,9 @@ discard block |
||
128 | 136 | */ |
129 | 137 | protected function normalizeField( array $field, array $defaults ) |
130 | 138 | { |
131 | - if( !$this->validate( $field ))return; |
|
139 | + if( !$this->validate( $field )) { |
|
140 | + return; |
|
141 | + } |
|
132 | 142 | return array_filter( shortcode_atts( $defaults, $field ), function( $value ) { |
133 | 143 | return $value !== ''; |
134 | 144 | }); |
@@ -149,7 +159,9 @@ discard block |
||
149 | 159 | 'type' => '', |
150 | 160 | 'value' => '', |
151 | 161 | ]); |
152 | - if( !is_array( $listbox ))return; |
|
162 | + if( !is_array( $listbox )) { |
|
163 | + return; |
|
164 | + } |
|
153 | 165 | if( !array_key_exists( '', $listbox['options'] )) { |
154 | 166 | $listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options']; |
155 | 167 | } |
@@ -30,7 +30,9 @@ |
||
30 | 30 | { |
31 | 31 | $diff = time() - strtotime( $date ); |
32 | 32 | foreach( static::$TIME_PERIODS as $i => $timePeriod ) { |
33 | - if( $diff > $timePeriod[0] )continue; |
|
33 | + if( $diff > $timePeriod[0] ) { |
|
34 | + continue; |
|
35 | + } |
|
34 | 36 | $unit = intval( floor( $diff / $timePeriod[1] )); |
35 | 37 | $relativeDates = [ |
36 | 38 | _n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ), |
@@ -161,7 +161,9 @@ discard block |
||
161 | 161 | if( !empty( $sessions )) { |
162 | 162 | $now = time(); |
163 | 163 | foreach( $sessions as $session ) { |
164 | - if( $now <= $session->expiration )continue; |
|
164 | + if( $now <= $session->expiration ) { |
|
165 | + continue; |
|
166 | + } |
|
165 | 167 | $expiredSessions[] = $session->name; |
166 | 168 | $expiredSessions[] = str_replace( '_expires_', '_', $session->name ); |
167 | 169 | } |
@@ -204,7 +206,9 @@ discard block |
||
204 | 206 | */ |
205 | 207 | protected function setCookie() |
206 | 208 | { |
207 | - if( headers_sent() )return; |
|
209 | + if( headers_sent() ) { |
|
210 | + return; |
|
211 | + } |
|
208 | 212 | $cookie = $this->sessionId.'||'.$this->expiryTimestamp.'||'.$this->expiryTimestampReset; |
209 | 213 | $cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' ))); |
210 | 214 | setcookie( static::SESSION_COOKIE, $cookie, $this->expiryTimestamp, $cookiePath ); |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | natsort( $routines ); |
17 | 17 | array_walk( $routines, function( $routine ) { |
18 | 18 | $version = str_replace( strtolower( __CLASS__ ).'_', '', $routine ); |
19 | - if( version_compare( glsr()->version, $version, '>=' ))return; |
|
19 | + if( version_compare( glsr()->version, $version, '>=' )) { |
|
20 | + return; |
|
21 | + } |
|
20 | 22 | call_user_func( [$this, $routine] ); |
21 | 23 | }); |
22 | 24 | $this->updateVersion(); |
@@ -37,5 +39,6 @@ discard block |
||
37 | 39 | } |
38 | 40 | |
39 | 41 | protected function upgrade_3_0_0() |
40 | - {} |
|
42 | + { |
|
43 | +} |
|
41 | 44 | } |