@@ -17,9 +17,13 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | $queries = []; |
| 19 | 19 | foreach( $keys as $key ) { |
| 20 | - if( !array_key_exists( $key, $values ))continue; |
|
| 20 | + if( !array_key_exists( $key, $values )) { |
|
| 21 | + continue; |
|
| 22 | + } |
|
| 21 | 23 | $methodName = glsr( Helper::class )->buildMethodName( $key, __FUNCTION__ ); |
| 22 | - if( !method_exists( $this, $methodName ))continue; |
|
| 24 | + if( !method_exists( $this, $methodName )) { |
|
| 25 | + continue; |
|
| 26 | + } |
|
| 23 | 27 | $query = call_user_func( [$this, $methodName], $values[$key] ); |
| 24 | 28 | if( is_array( $query )) { |
| 25 | 29 | $queries[] = $query; |
@@ -36,7 +40,9 @@ discard block |
||
| 36 | 40 | $string = ''; |
| 37 | 41 | $values = array_filter( $values ); |
| 38 | 42 | foreach( $conditions as $key => $value ) { |
| 39 | - if( !isset( $values[$key] ))continue; |
|
| 43 | + if( !isset( $values[$key] )) { |
|
| 44 | + continue; |
|
| 45 | + } |
|
| 40 | 46 | $values[$key] = implode( ',', (array)$values[$key] ); |
| 41 | 47 | $string .= strpos( $value, '%s' ) !== false |
| 42 | 48 | ? sprintf( $value, strval( $values[$key] )) |
@@ -110,7 +116,9 @@ discard block |
||
| 110 | 116 | */ |
| 111 | 117 | protected function buildQueryAssignedTo( $value ) |
| 112 | 118 | { |
| 113 | - if( empty( $value ))return; |
|
| 119 | + if( empty( $value )) { |
|
| 120 | + return; |
|
| 121 | + } |
|
| 114 | 122 | $postIds = glsr( Helper::class )->convertStringToArray( $value, 'is_numeric' ); |
| 115 | 123 | return [ |
| 116 | 124 | 'compare' => 'IN', |
@@ -125,7 +133,9 @@ discard block |
||
| 125 | 133 | */ |
| 126 | 134 | protected function buildQueryCategory( $value ) |
| 127 | 135 | { |
| 128 | - if( empty( $value ))return; |
|
| 136 | + if( empty( $value )) { |
|
| 137 | + return; |
|
| 138 | + } |
|
| 129 | 139 | return [ |
| 130 | 140 | 'field' => 'term_id', |
| 131 | 141 | 'taxonomy' => Application::TAXONOMY, |
@@ -139,7 +149,9 @@ discard block |
||
| 139 | 149 | */ |
| 140 | 150 | protected function buildQueryRating( $value ) |
| 141 | 151 | { |
| 142 | - if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return; |
|
| 152 | + if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) { |
|
| 153 | + return; |
|
| 154 | + } |
|
| 143 | 155 | return [ |
| 144 | 156 | 'compare' => '>=', |
| 145 | 157 | 'key' => 'rating', |
@@ -153,7 +165,9 @@ discard block |
||
| 153 | 165 | */ |
| 154 | 166 | protected function buildQueryType( $value ) |
| 155 | 167 | { |
| 156 | - if( in_array( $value, ['','all'] ))return; |
|
| 168 | + if( in_array( $value, ['','all'] )) { |
|
| 169 | + return; |
|
| 170 | + } |
|
| 157 | 171 | return [ |
| 158 | 172 | 'key' => 'review_type', |
| 159 | 173 | 'value' => $value, |
@@ -20,7 +20,9 @@ |
||
| 20 | 20 | public function build( array $args = [] ) |
| 21 | 21 | { |
| 22 | 22 | $this->args = $this->normalize( $args ); |
| 23 | - if( $this->args['total'] < 2 )return; |
|
| 23 | + if( $this->args['total'] < 2 ) { |
|
| 24 | + return; |
|
| 25 | + } |
|
| 24 | 26 | return glsr( Template::class )->build( 'templates/pagination', [ |
| 25 | 27 | 'context' => [ |
| 26 | 28 | 'links' => apply_filters( 'site-reviews/paginate_links', $this->buildLinks(), $this->args ), |
@@ -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 | } |
@@ -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 | }); |
@@ -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,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 | } |
@@ -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 | } |