@@ -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 | } |
@@ -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,12 +32,12 @@ 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 ))); |
|
35 | + $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
36 | 36 | $referer = apply_filters( 'site-reviews/review/redirect', $referer, $command ); |
37 | - if( empty( $referer )) { |
|
37 | + if( empty($referer) ) { |
|
38 | 38 | $referer = $command->referer; |
39 | 39 | } |
40 | - if( empty( $referer )) { |
|
40 | + if( empty($referer) ) { |
|
41 | 41 | glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->debug( $command ); |
42 | 42 | $referer = home_url(); |
43 | 43 | } |
@@ -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 | } |
@@ -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"> |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | $filenames = []; |
21 | 21 | $iterator = new DirectoryIterator( dirname( __FILE__ ).'/Upgrader' ); |
22 | 22 | foreach( $iterator as $fileinfo ) { |
23 | - if( !$fileinfo->isFile() )continue; |
|
23 | + if( !$fileinfo->isFile() ) { |
|
24 | + continue; |
|
25 | + } |
|
24 | 26 | $filenames[] = $fileinfo->getFilename(); |
25 | 27 | } |
26 | 28 | natsort( $filenames ); |
@@ -28,7 +30,9 @@ discard block |
||
28 | 30 | $className = str_replace( '.php', '', $file ); |
29 | 31 | $version = str_replace( ['Upgrade_', '_'], ['', '.'], $className ); |
30 | 32 | $versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions |
31 | - if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return; |
|
33 | + if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' )) { |
|
34 | + return; |
|
35 | + } |
|
32 | 36 | glsr( 'Modules\\Upgrader\\'.$className ); |
33 | 37 | glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix ); |
34 | 38 | }); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $className = str_replace( '.php', '', $file ); |
25 | 25 | $version = str_replace( ['Upgrade_', '_'], ['', '.'], $className ); |
26 | 26 | $versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions |
27 | - if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return; |
|
27 | + if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ) )return; |
|
28 | 28 | glsr( 'Modules\\Upgrader\\'.$className ); |
29 | 29 | glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix ); |
30 | 30 | }); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $this->setReviewCounts(); |
42 | 42 | $this->updateVersionFrom( $version ); |
43 | 43 | } |
44 | - else if( !glsr( OptionManager::class )->get( 'last_review_count', false )) { |
|
44 | + else if( !glsr( OptionManager::class )->get( 'last_review_count', false ) ) { |
|
45 | 45 | $this->setReviewCounts(); |
46 | 46 | } |
47 | 47 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | protected function filterAttributes( array $allowedAttributeKeys ) |
124 | 124 | { |
125 | - return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys )); |
|
125 | + return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ) ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $globalAttributes = $this->filterAttributes( static::GLOBAL_ATTRIBUTES ); |
134 | 134 | $wildcards = []; |
135 | 135 | foreach( static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard ) { |
136 | - $newWildcards = array_filter( $this->attributes, function( $key ) use( $wildcard ) { |
|
136 | + $newWildcards = array_filter( $this->attributes, function( $key ) use($wildcard) { |
|
137 | 137 | return glsr( Helper::class )->startsWith( $wildcard, $key ); |
138 | 138 | }, ARRAY_FILTER_USE_KEY ); |
139 | 139 | $wildcards = array_merge( $wildcards, $newWildcards ); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | protected function getPermanentAttributes() |
148 | 148 | { |
149 | 149 | $permanentAttributes = []; |
150 | - if( array_key_exists( 'value', $this->attributes )) { |
|
150 | + if( array_key_exists( 'value', $this->attributes ) ) { |
|
151 | 151 | $permanentAttributes['value'] = $this->attributes['value']; |
152 | 152 | } |
153 | 153 | return $permanentAttributes; |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | protected function normalizeBooleanAttributes() |
200 | 200 | { |
201 | 201 | foreach( $this->attributes as $key => $value ) { |
202 | - if( $this->isAttributeKeyNumeric( $key, $value )) { |
|
202 | + if( $this->isAttributeKeyNumeric( $key, $value ) ) { |
|
203 | 203 | $key = $value; |
204 | 204 | $value = true; |
205 | 205 | } |
206 | - if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue; |
|
206 | + if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ) )continue; |
|
207 | 207 | $this->attributes[$key] = wp_validate_boolean( $value ); |
208 | 208 | } |
209 | 209 | } |
@@ -214,13 +214,13 @@ discard block |
||
214 | 214 | protected function normalizeDataAttributes() |
215 | 215 | { |
216 | 216 | foreach( $this->attributes as $key => $value ) { |
217 | - if( $this->isAttributeKeyNumeric( $key, $value )) { |
|
217 | + if( $this->isAttributeKeyNumeric( $key, $value ) ) { |
|
218 | 218 | $key = $value; |
219 | 219 | $value = ''; |
220 | 220 | } |
221 | - if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue; |
|
222 | - if( is_array( $value )) { |
|
223 | - $value = json_encode( $value, JSON_HEX_APOS|JSON_NUMERIC_CHECK|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE ); |
|
221 | + if( !glsr( Helper::class )->startsWith( 'data-', $key ) )continue; |
|
222 | + if( is_array( $value ) ) { |
|
223 | + $value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); |
|
224 | 224 | } |
225 | 225 | $this->attributes[$key] = $value; |
226 | 226 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | protected function normalizeStringAttributes() |
233 | 233 | { |
234 | 234 | foreach( $this->attributes as $key => $value ) { |
235 | - if( !is_string( $value ))continue; |
|
235 | + if( !is_string( $value ) )continue; |
|
236 | 236 | $this->attributes[$key] = trim( $value ); |
237 | 237 | } |
238 | 238 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | if( $method != 'input' )return; |
247 | 247 | $attributes = wp_parse_args( $this->attributes, ['type' => ''] ); |
248 | - if( !in_array( $attributes['type'], static::INPUT_TYPES )) { |
|
248 | + if( !in_array( $attributes['type'], static::INPUT_TYPES ) ) { |
|
249 | 249 | $this->attributes['type'] = 'text'; |
250 | 250 | } |
251 | 251 | } |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | $permanentAttributes = $this->getPermanentAttributes(); |
260 | 260 | foreach( $this->attributes as $key => $value ) { |
261 | 261 | if( in_array( $key, static::BOOLEAN_ATTRIBUTES ) && !$value ) { |
262 | - unset( $attributes[$key] ); |
|
262 | + unset($attributes[$key]); |
|
263 | 263 | } |
264 | - if( glsr( Helper::class )->startsWith( 'data-', $key )) { |
|
264 | + if( glsr( Helper::class )->startsWith( 'data-', $key ) ) { |
|
265 | 265 | $permanentAttributes[$key] = $value; |
266 | - unset( $attributes[$key] ); |
|
266 | + unset($attributes[$key]); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | $this->attributes = array_merge( array_filter( $attributes ), $permanentAttributes ); |
@@ -203,7 +203,9 @@ discard block |
||
203 | 203 | $key = $value; |
204 | 204 | $value = true; |
205 | 205 | } |
206 | - if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue; |
|
206 | + if( !in_array( $key, static::BOOLEAN_ATTRIBUTES )) { |
|
207 | + continue; |
|
208 | + } |
|
207 | 209 | $this->attributes[$key] = wp_validate_boolean( $value ); |
208 | 210 | } |
209 | 211 | } |
@@ -218,7 +220,9 @@ discard block |
||
218 | 220 | $key = $value; |
219 | 221 | $value = ''; |
220 | 222 | } |
221 | - if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue; |
|
223 | + if( !glsr( Helper::class )->startsWith( 'data-', $key )) { |
|
224 | + continue; |
|
225 | + } |
|
222 | 226 | if( is_array( $value )) { |
223 | 227 | $value = json_encode( $value, JSON_HEX_APOS|JSON_NUMERIC_CHECK|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE ); |
224 | 228 | } |
@@ -232,7 +236,9 @@ discard block |
||
232 | 236 | protected function normalizeStringAttributes() |
233 | 237 | { |
234 | 238 | foreach( $this->attributes as $key => $value ) { |
235 | - if( !is_string( $value ))continue; |
|
239 | + if( !is_string( $value )) { |
|
240 | + continue; |
|
241 | + } |
|
236 | 242 | $this->attributes[$key] = trim( $value ); |
237 | 243 | } |
238 | 244 | } |
@@ -243,7 +249,9 @@ discard block |
||
243 | 249 | */ |
244 | 250 | protected function normalizeInputType( $method ) |
245 | 251 | { |
246 | - if( $method != 'input' )return; |
|
252 | + if( $method != 'input' ) { |
|
253 | + return; |
|
254 | + } |
|
247 | 255 | $attributes = wp_parse_args( $this->attributes, ['type' => ''] ); |
248 | 256 | if( !in_array( $attributes['type'], static::INPUT_TYPES )) { |
249 | 257 | $this->attributes['type'] = 'text'; |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | { |
75 | 75 | $this->newSettings = $this->getNewSettings(); |
76 | 76 | $this->oldSettings = $this->getOldSettings(); |
77 | - if( empty( $this->oldSettings ))return; |
|
77 | + if( empty($this->oldSettings) )return; |
|
78 | 78 | foreach( static::MAPPED_SETTINGS as $old => $new ) { |
79 | - if( empty( $this->oldSettings[$old] ))continue; |
|
79 | + if( empty($this->oldSettings[$old]) )continue; |
|
80 | 80 | $this->newSettings[$new] = $this->oldSettings[$old]; |
81 | 81 | } |
82 | 82 | $this->migrateNotificationSettings(); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->migrateRequiredSettings(); |
85 | 85 | $oldSettings = glsr( Helper::class )->convertDotNotationArray( $this->oldSettings ); |
86 | 86 | $newSettings = glsr( Helper::class )->convertDotNotationArray( $this->newSettings ); |
87 | - if( isset( $oldSettings['settings']['strings'] ) && is_array( $oldSettings['settings']['strings'] )) { |
|
87 | + if( isset($oldSettings['settings']['strings']) && is_array( $oldSettings['settings']['strings'] ) ) { |
|
88 | 88 | $newSettings['settings']['strings'] = $oldSettings['settings']['strings']; |
89 | 89 | } |
90 | 90 | glsr( OptionManager::class )->set( $newSettings ); |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | protected function getOldSettings() |
118 | 118 | { |
119 | 119 | $defaults = array_fill_keys( array_keys( static::MAPPED_SETTINGS ), '' ); |
120 | - $settings = glsr( Helper::class )->flattenArray( get_option( 'geminilabs_site_reviews-v2', [] )); |
|
121 | - if( !empty( $settings )) { |
|
120 | + $settings = glsr( Helper::class )->flattenArray( get_option( 'geminilabs_site_reviews-v2', [] ) ); |
|
121 | + if( !empty($settings) ) { |
|
122 | 122 | $settings = wp_parse_args( $settings, $defaults ); |
123 | 123 | } |
124 | 124 | return $settings; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | 'SecretKey' => $this->oldSettings['settings.reviews-form.recaptcha.secret'], |
152 | 152 | 'SiteKey' => $this->oldSettings['settings.reviews-form.recaptcha.key'], |
153 | 153 | ]; |
154 | - if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] )) { |
|
154 | + if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] ) ) { |
|
155 | 155 | $this->newSettings['settings.submissions.recaptcha.integration'] = 'all'; |
156 | 156 | } |
157 | 157 | if( $this->oldSettings['settings.reviews-form.recaptcha.integration'] == 'invisible-recaptcha' ) { |
@@ -74,9 +74,13 @@ discard block |
||
74 | 74 | { |
75 | 75 | $this->newSettings = $this->getNewSettings(); |
76 | 76 | $this->oldSettings = $this->getOldSettings(); |
77 | - if( empty( $this->oldSettings ))return; |
|
77 | + if( empty( $this->oldSettings )) { |
|
78 | + return; |
|
79 | + } |
|
78 | 80 | foreach( static::MAPPED_SETTINGS as $old => $new ) { |
79 | - if( empty( $this->oldSettings[$old] ))continue; |
|
81 | + if( empty( $this->oldSettings[$old] )) { |
|
82 | + continue; |
|
83 | + } |
|
80 | 84 | $this->newSettings[$new] = $this->oldSettings[$old]; |
81 | 85 | } |
82 | 86 | $this->migrateNotificationSettings(); |
@@ -136,7 +140,9 @@ discard block |
||
136 | 140 | ]; |
137 | 141 | $this->newSettings['settings.general.notifications'] = []; |
138 | 142 | foreach( $notifications as $old => $new ) { |
139 | - if( $this->oldSettings['settings.general.notification'] != $old )continue; |
|
143 | + if( $this->oldSettings['settings.general.notification'] != $old ) { |
|
144 | + continue; |
|
145 | + } |
|
140 | 146 | $this->newSettings['settings.general.notifications'][] = $new; |
141 | 147 | } |
142 | 148 | } |
@@ -14,14 +14,14 @@ |
||
14 | 14 | { |
15 | 15 | foreach( $command->popups as $slug => $label ) { |
16 | 16 | $buttonClass = glsr( Helper::class )->buildClassName( $slug.'-popup', 'Shortcodes' ); |
17 | - if( !class_exists( $buttonClass )) { |
|
18 | - glsr_log()->error( sprintf( 'Class missing (%s)', $buttonClass )); |
|
17 | + if( !class_exists( $buttonClass ) ) { |
|
18 | + glsr_log()->error( sprintf( 'Class missing (%s)', $buttonClass ) ); |
|
19 | 19 | continue; |
20 | 20 | } |
21 | 21 | $shortcode = glsr( $buttonClass )->register( $slug, [ |
22 | 22 | 'label' => $label, |
23 | 23 | 'title' => $label, |
24 | - ]); |
|
24 | + ] ); |
|
25 | 25 | glsr()->mceShortcodes[$slug] = $shortcode->properties; |
26 | 26 | } |
27 | 27 | } |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | public function routeAdminPostRequest() |
18 | 18 | { |
19 | 19 | $request = $this->getRequest(); |
20 | - if( !$this->isValidPostRequest( $request ))return; |
|
20 | + if( !$this->isValidPostRequest( $request )) { |
|
21 | + return; |
|
22 | + } |
|
21 | 23 | check_admin_referer( $request['_action'] ); |
22 | 24 | $this->routeRequest( 'admin', $request['_action'], $request ); |
23 | 25 | } |
@@ -39,10 +41,16 @@ discard block |
||
39 | 41 | */ |
40 | 42 | public function routePublicPostRequest() |
41 | 43 | { |
42 | - if( is_admin() )return; |
|
44 | + if( is_admin() ) { |
|
45 | + return; |
|
46 | + } |
|
43 | 47 | $request = $this->getRequest(); |
44 | - if( !$this->isValidPostRequest( $request ))return; |
|
45 | - if( !$this->isValidPublicNonce( $request ))return; |
|
48 | + if( !$this->isValidPostRequest( $request )) { |
|
49 | + return; |
|
50 | + } |
|
51 | + if( !$this->isValidPublicNonce( $request )) { |
|
52 | + return; |
|
53 | + } |
|
46 | 54 | $this->routeRequest( 'public', $request['_action'], $request ); |
47 | 55 | } |
48 | 56 | |
@@ -51,7 +59,9 @@ discard block |
||
51 | 59 | */ |
52 | 60 | protected function checkAjaxNonce( array $request ) |
53 | 61 | { |
54 | - if( !is_user_logged_in() )return; |
|
62 | + if( !is_user_logged_in() ) { |
|
63 | + return; |
|
64 | + } |
|
55 | 65 | if( !isset( $request['_nonce'] )) { |
56 | 66 | $this->sendAjaxError( 'request is missing a nonce', $request ); |
57 | 67 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | public function routeAdminPostRequest() |
18 | 18 | { |
19 | 19 | $request = $this->getRequest(); |
20 | - if( !$this->isValidPostRequest( $request ))return; |
|
20 | + if( !$this->isValidPostRequest( $request ) )return; |
|
21 | 21 | check_admin_referer( $request['_action'] ); |
22 | 22 | $this->routeRequest( 'admin', $request['_action'], $request ); |
23 | 23 | } |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | { |
42 | 42 | if( is_admin() )return; |
43 | 43 | $request = $this->getRequest(); |
44 | - if( !$this->isValidPostRequest( $request ))return; |
|
45 | - if( !$this->isValidPublicNonce( $request ))return; |
|
44 | + if( !$this->isValidPostRequest( $request ) )return; |
|
45 | + if( !$this->isValidPublicNonce( $request ) )return; |
|
46 | 46 | $this->routeRequest( 'public', $request['_action'], $request ); |
47 | 47 | } |
48 | 48 | |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | protected function checkAjaxNonce( array $request ) |
53 | 53 | { |
54 | 54 | if( !is_user_logged_in() )return; |
55 | - if( !isset( $request['_nonce'] )) { |
|
55 | + if( !isset($request['_nonce']) ) { |
|
56 | 56 | $this->sendAjaxError( 'request is missing a nonce', $request ); |
57 | 57 | } |
58 | - if( !wp_verify_nonce( $request['_nonce'], $request['_action'] )) { |
|
58 | + if( !wp_verify_nonce( $request['_nonce'], $request['_action'] ) ) { |
|
59 | 59 | $this->sendAjaxError( 'request failed the nonce check', $request, 403 ); |
60 | 60 | } |
61 | 61 | } |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | */ |
66 | 66 | protected function checkAjaxRequest( array $request ) |
67 | 67 | { |
68 | - if( !isset( $request['_action'] )) { |
|
68 | + if( !isset($request['_action']) ) { |
|
69 | 69 | $this->sendAjaxError( 'request must include an action', $request ); |
70 | 70 | } |
71 | - if( empty( $request['_ajax_request'] )) { |
|
71 | + if( empty($request['_ajax_request']) ) { |
|
72 | 72 | $this->sendAjaxError( 'request is invalid', $request ); |
73 | 73 | } |
74 | 74 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | protected function isValidPostRequest( array $request = [] ) |
97 | 97 | { |
98 | - return !empty( $request['_action'] ) && empty( $request['_ajax_request'] ); |
|
98 | + return !empty($request['_action']) && empty($request['_ajax_request']); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function isValidPublicNonce( array $request ) |
105 | 105 | { |
106 | - if( is_user_logged_in() && !wp_verify_nonce( $request['_nonce'], $request['_action'] )) { |
|
106 | + if( is_user_logged_in() && !wp_verify_nonce( $request['_nonce'], $request['_action'] ) ) { |
|
107 | 107 | glsr_log()->error( 'nonce check failed for public request' )->debug( $request ); |
108 | 108 | return false; |
109 | 109 | } |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | protected function routeRequest( $type, $action, array $request = [] ) |
119 | 119 | { |
120 | 120 | $actionHook = 'site-reviews/route/'.$type.'/request'; |
121 | - $controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' )); |
|
121 | + $controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ) ); |
|
122 | 122 | $method = glsr( Helper::class )->buildMethodName( $action, 'router' ); |
123 | 123 | $request = apply_filters( 'site-reviews/route/request', $request, $action, $type ); |
124 | 124 | do_action( $actionHook, $action, $request ); |
125 | - if( is_callable( [$controller, $method] )) { |
|
125 | + if( is_callable( [$controller, $method] ) ) { |
|
126 | 126 | call_user_func( [$controller, $method], $request ); |
127 | 127 | return; |
128 | 128 | } |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | { |
141 | 141 | glsr_log()->error( $error )->debug( $request ); |
142 | 142 | glsr( Notice::class )->addError( __( 'There was an error (try refreshing the page).', 'site-reviews' ).' <code>'.$error.'</code>' ); |
143 | - wp_send_json_error([ |
|
143 | + wp_send_json_error( [ |
|
144 | 144 | 'message' => __( 'The form could not be submitted. Please notify the site administrator.', 'site-reviews' ), |
145 | 145 | 'notices' => glsr( Notice::class )->get(), |
146 | 146 | 'error' => $error, |
147 | - ]); |
|
147 | + ] ); |
|
148 | 148 | } |
149 | 149 | } |