@@ -55,7 +55,9 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function enqueuePolyfillService() |
| 57 | 57 | { |
| 58 | - if( !apply_filters( 'site-reviews/assets/polyfill', true ))return; |
|
| 58 | + if( !apply_filters( 'site-reviews/assets/polyfill', true )) { |
|
| 59 | + return; |
|
| 60 | + } |
|
| 59 | 61 | wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([ |
| 60 | 62 | 'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event,MutationObserver', |
| 61 | 63 | 'flags' => 'gated', |
@@ -70,7 +72,9 @@ discard block |
||
| 70 | 72 | // wpforms-recaptcha |
| 71 | 73 | // google-recaptcha |
| 72 | 74 | // nf-google-recaptcha |
| 73 | - if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return; |
|
| 75 | + if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) { |
|
| 76 | + return; |
|
| 77 | + } |
|
| 74 | 78 | $language = apply_filters( 'site-reviews/recaptcha/language', get_locale() ); |
| 75 | 79 | wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
| 76 | 80 | 'hl' => $language, |
@@ -84,7 +88,9 @@ discard block |
||
| 84 | 88 | public function inlineStyles() |
| 85 | 89 | { |
| 86 | 90 | $inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' ); |
| 87 | - if( !apply_filters( 'site-reviews/assets/css', true ))return; |
|
| 91 | + if( !apply_filters( 'site-reviews/assets/css', true )) { |
|
| 92 | + return; |
|
| 93 | + } |
|
| 88 | 94 | if( !file_exists( $inlineStylesheetPath )) { |
| 89 | 95 | glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath ); |
| 90 | 96 | return; |
@@ -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 | } |
@@ -85,7 +85,9 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | protected function buildRecaptcha() |
| 87 | 87 | { |
| 88 | - if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return; |
|
| 88 | + if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) { |
|
| 89 | + return; |
|
| 90 | + } |
|
| 89 | 91 | return glsr( Builder::class )->div([ |
| 90 | 92 | 'class' => 'glsr-recaptcha-holder', |
| 91 | 93 | 'data-badge' => glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ), |
@@ -144,7 +146,9 @@ discard block |
||
| 144 | 146 | }, $hiddenFields ); |
| 145 | 147 | foreach( $fields as $field ) { |
| 146 | 148 | $index = array_search( $field->field['path'], $paths ); |
| 147 | - if( $index === false )continue; |
|
| 149 | + if( $index === false ) { |
|
| 150 | + continue; |
|
| 151 | + } |
|
| 148 | 152 | unset( $hiddenFields[$index] ); |
| 149 | 153 | } |
| 150 | 154 | return array_merge( $hiddenFields, $fields ); |
@@ -167,7 +171,9 @@ discard block |
||
| 167 | 171 | */ |
| 168 | 172 | protected function getRegisterText() |
| 169 | 173 | { |
| 170 | - if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' )return; |
|
| 174 | + if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' ) { |
|
| 175 | + return; |
|
| 176 | + } |
|
| 171 | 177 | $registerLink = glsr( Builder::class )->a([ |
| 172 | 178 | 'href' => wp_registration_url(), |
| 173 | 179 | 'text' => __( 'register', 'site-reviews' ), |
@@ -228,7 +234,9 @@ discard block |
||
| 228 | 234 | */ |
| 229 | 235 | protected function normalizeFieldId( Field &$field ) |
| 230 | 236 | { |
| 231 | - if( empty( $this->args['id'] ) || empty( $field->field['id'] ))return; |
|
| 237 | + if( empty( $this->args['id'] ) || empty( $field->field['id'] )) { |
|
| 238 | + return; |
|
| 239 | + } |
|
| 232 | 240 | $field->field['id'].= '-'.$this->args['id']; |
| 233 | 241 | } |
| 234 | 242 | |
@@ -248,7 +256,9 @@ discard block |
||
| 248 | 256 | */ |
| 249 | 257 | protected function normalizeFieldErrors( Field &$field ) |
| 250 | 258 | { |
| 251 | - if( !array_key_exists( $field->field['path'], $this->errors ))return; |
|
| 259 | + if( !array_key_exists( $field->field['path'], $this->errors )) { |
|
| 260 | + return; |
|
| 261 | + } |
|
| 252 | 262 | $field->field['errors'] = $this->errors[$field->field['path']]; |
| 253 | 263 | } |
| 254 | 264 | |
@@ -257,7 +267,9 @@ discard block |
||
| 257 | 267 | */ |
| 258 | 268 | protected function normalizeFieldRequired( Field &$field ) |
| 259 | 269 | { |
| 260 | - if( !in_array( $field->field['path'], $this->required ))return; |
|
| 270 | + if( !in_array( $field->field['path'], $this->required )) { |
|
| 271 | + return; |
|
| 272 | + } |
|
| 261 | 273 | $field->field['required'] = true; |
| 262 | 274 | } |
| 263 | 275 | |
@@ -268,7 +280,9 @@ discard block |
||
| 268 | 280 | { |
| 269 | 281 | $normalizedFields = []; |
| 270 | 282 | foreach( $fields as $field ) { |
| 271 | - if( in_array( $field->field['path'], $this->args['hide'] ))continue; |
|
| 283 | + if( in_array( $field->field['path'], $this->args['hide'] )) { |
|
| 284 | + continue; |
|
| 285 | + } |
|
| 272 | 286 | $field->field['is_public'] = true; |
| 273 | 287 | $this->normalizeFieldClass( $field ); |
| 274 | 288 | $this->normalizeFieldErrors( $field ); |
@@ -285,7 +299,9 @@ discard block |
||
| 285 | 299 | */ |
| 286 | 300 | protected function normalizeFieldValue( Field &$field ) |
| 287 | 301 | { |
| 288 | - if( !array_key_exists( $field->field['path'], $this->values ))return; |
|
| 302 | + if( !array_key_exists( $field->field['path'], $this->values )) { |
|
| 303 | + return; |
|
| 304 | + } |
|
| 289 | 305 | if( in_array( $field->field['type'], ['radio', 'checkbox'] )) { |
| 290 | 306 | $field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']]; |
| 291 | 307 | } |
@@ -39,7 +39,9 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function removeAutosave() |
| 41 | 41 | { |
| 42 | - if( !$this->isReviewEditor() || $this->isReviewEditable() )return; |
|
| 42 | + if( !$this->isReviewEditor() || $this->isReviewEditable() ) { |
|
| 43 | + return; |
|
| 44 | + } |
|
| 43 | 45 | wp_deregister_script( 'autosave' ); |
| 44 | 46 | } |
| 45 | 47 | |
@@ -56,7 +58,9 @@ discard block |
||
| 56 | 58 | */ |
| 57 | 59 | public function removePostTypeSupport() |
| 58 | 60 | { |
| 59 | - if( !$this->isReviewEditor() || $this->isReviewEditable() )return; |
|
| 61 | + if( !$this->isReviewEditor() || $this->isReviewEditable() ) { |
|
| 62 | + return; |
|
| 63 | + } |
|
| 60 | 64 | remove_post_type_support( Application::POST_TYPE, 'title' ); |
| 61 | 65 | remove_post_type_support( Application::POST_TYPE, 'editor' ); |
| 62 | 66 | } |
@@ -35,7 +35,9 @@ discard block |
||
| 35 | 35 | foreach( glsr( ReviewManager::class )->get( $this->args )->results as $review ) { |
| 36 | 36 | // Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews. |
| 37 | 37 | // @see https://developers.google.com/search/docs/data-types/review |
| 38 | - if( $review->review_type != 'local' )continue; |
|
| 38 | + if( $review->review_type != 'local' ) { |
|
| 39 | + continue; |
|
| 40 | + } |
|
| 39 | 41 | $reviews[] = $this->buildReview( $review ); |
| 40 | 42 | } |
| 41 | 43 | if( !empty( $reviews )) { |
@@ -80,7 +82,9 @@ discard block |
||
| 80 | 82 | */ |
| 81 | 83 | public function render() |
| 82 | 84 | { |
| 83 | - if( empty( glsr()->schemas ))return; |
|
| 85 | + if( empty( glsr()->schemas )) { |
|
| 86 | + return; |
|
| 87 | + } |
|
| 84 | 88 | printf( '<script type="application/ld+json">%s</script>', json_encode( |
| 85 | 89 | apply_filters( 'site-reviews/schema/all', glsr()->schemas ), |
| 86 | 90 | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES |
@@ -132,7 +136,9 @@ discard block |
||
| 132 | 136 | { |
| 133 | 137 | foreach( $values as $value ) { |
| 134 | 138 | $option = $this->getSchemaOptionValue( $value ); |
| 135 | - if( empty( $option ))continue; |
|
| 139 | + if( empty( $option )) { |
|
| 140 | + continue; |
|
| 141 | + } |
|
| 136 | 142 | $schema->$value( $option ); |
| 137 | 143 | } |
| 138 | 144 | return $schema; |
@@ -242,7 +248,9 @@ discard block |
||
| 242 | 248 | if( $value != $fallback ) { |
| 243 | 249 | return $value; |
| 244 | 250 | } |
| 245 | - if( !is_single() && !is_page() )return; |
|
| 251 | + if( !is_single() && !is_page() ) { |
|
| 252 | + return; |
|
| 253 | + } |
|
| 246 | 254 | $method = glsr( Helper::class )->buildMethodName( $option, 'getThing' ); |
| 247 | 255 | if( method_exists( $this, $method )) { |
| 248 | 256 | return $this->$method(); |
@@ -8,7 +8,10 @@ |
||
| 8 | 8 | <textarea readonly><?= esc_attr( $post->post_content ); ?></textarea> |
| 9 | 9 | </div> |
| 10 | 10 | |
| 11 | -<?php if( empty( $response ))return; ?> |
|
| 11 | +<?php if( empty( $response )) { |
|
| 12 | + return; |
|
| 13 | +} |
|
| 14 | +?> |
|
| 12 | 15 | |
| 13 | 16 | <div class="postbox glsr-response-postbox"> |
| 14 | 17 | <button type="button" class="handlediv" aria-expanded="true"> |
@@ -13,7 +13,9 @@ |
||
| 13 | 13 | public function getPost( $postId ) |
| 14 | 14 | { |
| 15 | 15 | $postId = trim( $postId ); |
| 16 | - if( empty( $postId ) || !is_numeric( $postId ))return; |
|
| 16 | + if( empty( $postId ) || !is_numeric( $postId )) { |
|
| 17 | + return; |
|
| 18 | + } |
|
| 17 | 19 | if( $this->isEnabled() ) { |
| 18 | 20 | $polylangPostId = pll_get_post( $postId, pll_get_post_language( get_the_ID() )); |
| 19 | 21 | } |
@@ -15,7 +15,9 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function download( $filename, $content ) |
| 17 | 17 | { |
| 18 | - if( !current_user_can( glsr()->constant( 'CAPABILITY' )))return; |
|
| 18 | + if( !current_user_can( glsr()->constant( 'CAPABILITY' ))) { |
|
| 19 | + return; |
|
| 20 | + } |
|
| 19 | 21 | nocache_headers(); |
| 20 | 22 | header( 'Content-Type: text/plain' ); |
| 21 | 23 | header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); |
@@ -22,7 +22,9 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | global $menu, $typenow; |
| 24 | 24 | foreach( $menu as $key => $value ) { |
| 25 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 25 | + if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) { |
|
| 26 | + continue; |
|
| 27 | + } |
|
| 26 | 28 | $postCount = wp_count_posts( Application::POST_TYPE ); |
| 27 | 29 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
| 28 | 30 | 'class' => 'pending-count', |
@@ -53,7 +55,9 @@ discard block |
||
| 53 | 55 | foreach( $pages as $slug => $title ) { |
| 54 | 56 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
| 55 | 57 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
| 56 | - if( !is_callable( $callback ))continue; |
|
| 58 | + if( !is_callable( $callback )) { |
|
| 59 | + continue; |
|
| 60 | + } |
|
| 57 | 61 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->constant( 'CAPABILITY' ), $slug, $callback ); |
| 58 | 62 | } |
| 59 | 63 | } |