@@ -48,7 +48,9 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | public function enqueueRecaptchaScript() |
| 50 | 50 | { |
| 51 | - if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' )return; |
|
| 51 | + if( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ) != 'custom' ) { |
|
| 52 | + return; |
|
| 53 | + } |
|
| 52 | 54 | $language = apply_filters( 'site-reviews/recaptcha/language', get_locale() ); |
| 53 | 55 | wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
| 54 | 56 | 'hl' => $language, |
@@ -80,7 +80,9 @@ discard block |
||
| 80 | 80 | ]; |
| 81 | 81 | if( !isset( $properties[$property] ) |
| 82 | 82 | || empty( array_filter( [$value], $properties[$property] )) |
| 83 | - )return; |
|
| 83 | + ) { |
|
| 84 | + return; |
|
| 85 | + } |
|
| 84 | 86 | $this->$property = $value; |
| 85 | 87 | } |
| 86 | 88 | |
@@ -129,7 +131,9 @@ discard block |
||
| 129 | 131 | */ |
| 130 | 132 | protected function buildFieldDescription() |
| 131 | 133 | { |
| 132 | - if( empty( $this->args['description'] ))return; |
|
| 134 | + if( empty( $this->args['description'] )) { |
|
| 135 | + return; |
|
| 136 | + } |
|
| 133 | 137 | if( $this->args['is_widget'] ) { |
| 134 | 138 | return $this->small( $this->args['description'] ); |
| 135 | 139 | } |
@@ -184,7 +188,9 @@ discard block |
||
| 184 | 188 | */ |
| 185 | 189 | protected function buildFormLabel() |
| 186 | 190 | { |
| 187 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
| 191 | + if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' ) { |
|
| 192 | + return; |
|
| 193 | + } |
|
| 188 | 194 | return $this->label([ |
| 189 | 195 | 'for' => $this->args['id'], |
| 190 | 196 | 'text' => $this->args['label'], |
@@ -36,7 +36,9 @@ discard block |
||
| 36 | 36 | [], |
| 37 | 37 | glsr()->version |
| 38 | 38 | ); |
| 39 | - if( !$this->isCurrentScreen() )return; |
|
| 39 | + if( !$this->isCurrentScreen() ) { |
|
| 40 | + return; |
|
| 41 | + } |
|
| 40 | 42 | wp_enqueue_script( |
| 41 | 43 | Application::ID, |
| 42 | 44 | glsr()->url( 'assets/scripts/'.Application::ID.'-admin.js' ), |
@@ -113,8 +115,12 @@ discard block |
||
| 113 | 115 | $dismissedPointers = explode( ',', (string)$dismissedPointers ); |
| 114 | 116 | $generatedPointers = []; |
| 115 | 117 | foreach( $pointers as $pointer ) { |
| 116 | - if( $pointer['screen'] != glsr_current_screen()->id )continue; |
|
| 117 | - if( in_array( $pointer['id'], $dismissedPointers ))continue; |
|
| 118 | + if( $pointer['screen'] != glsr_current_screen()->id ) { |
|
| 119 | + continue; |
|
| 120 | + } |
|
| 121 | + if( in_array( $pointer['id'], $dismissedPointers )) { |
|
| 122 | + continue; |
|
| 123 | + } |
|
| 118 | 124 | $generatedPointers[] = $this->generatePointer( $pointer ); |
| 119 | 125 | } |
| 120 | 126 | $this->pointers = $generatedPointers; |
@@ -140,7 +146,9 @@ discard block |
||
| 140 | 146 | { |
| 141 | 147 | $variables = []; |
| 142 | 148 | foreach( glsr()->mceShortcodes as $tag => $args ) { |
| 143 | - if( empty( $args['required'] ))continue; |
|
| 149 | + if( empty( $args['required'] )) { |
|
| 150 | + continue; |
|
| 151 | + } |
|
| 144 | 152 | $variables[$tag] = $args['required']; |
| 145 | 153 | } |
| 146 | 154 | return $variables; |
@@ -15,9 +15,13 @@ |
||
| 15 | 15 | ]; |
| 16 | 16 | foreach( $namespaces as $prefix => $baseDir ) { |
| 17 | 17 | $len = strlen( $prefix ); |
| 18 | - if( strncmp( $prefix, $className, $len ) !== 0 )continue; |
|
| 18 | + if( strncmp( $prefix, $className, $len ) !== 0 ) { |
|
| 19 | + continue; |
|
| 20 | + } |
|
| 19 | 21 | $file = $baseDir.str_replace( '\\', '/', substr( $className, $len )).'.php'; |
| 20 | - if( !file_exists( $file ))continue; |
|
| 22 | + if( !file_exists( $file )) { |
|
| 23 | + continue; |
|
| 24 | + } |
|
| 21 | 25 | require $file; |
| 22 | 26 | break; |
| 23 | 27 | } |
@@ -50,7 +50,9 @@ |
||
| 50 | 50 | public function routerSubmitReview( array $request ) |
| 51 | 51 | { |
| 52 | 52 | $validated = glsr( ValidateReview::class )->validate( $request ); |
| 53 | - if( !empty( $validated->error ) || $validated->recaptchaIsUnset )return; |
|
| 53 | + if( !empty( $validated->error ) || $validated->recaptchaIsUnset ) { |
|
| 54 | + return; |
|
| 55 | + } |
|
| 54 | 56 | $this->execute( new CreateReview( $validated->request )); |
| 55 | 57 | } |
| 56 | 58 | } |
@@ -152,7 +152,9 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | protected function normalizeFieldErrors( Field &$field ) |
| 154 | 154 | { |
| 155 | - if( !array_key_exists( $field->field['path'], $this->errors ))return; |
|
| 155 | + if( !array_key_exists( $field->field['path'], $this->errors )) { |
|
| 156 | + return; |
|
| 157 | + } |
|
| 156 | 158 | $field->field['errors'] = $this->errors[$field->field['path']]; |
| 157 | 159 | } |
| 158 | 160 | |
@@ -161,7 +163,9 @@ discard block |
||
| 161 | 163 | */ |
| 162 | 164 | protected function normalizeFieldRequired( Field &$field ) |
| 163 | 165 | { |
| 164 | - if( !in_array( $field->field['path'], $this->required ))return; |
|
| 166 | + if( !in_array( $field->field['path'], $this->required )) { |
|
| 167 | + return; |
|
| 168 | + } |
|
| 165 | 169 | $field->field['required'] = true; |
| 166 | 170 | } |
| 167 | 171 | |
@@ -183,7 +187,9 @@ discard block |
||
| 183 | 187 | */ |
| 184 | 188 | protected function normalizeFieldValue( Field &$field ) |
| 185 | 189 | { |
| 186 | - if( !array_key_exists( $field->field['path'], $this->values ))return; |
|
| 190 | + if( !array_key_exists( $field->field['path'], $this->values )) { |
|
| 191 | + return; |
|
| 192 | + } |
|
| 187 | 193 | if( in_array( $field->field['type'], ['radio', 'checkbox'] )) { |
| 188 | 194 | $field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']]; |
| 189 | 195 | } |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function build() |
| 45 | 45 | { |
| 46 | - if( !$this->field['is_valid'] )return; |
|
| 46 | + if( !$this->field['is_valid'] ) { |
|
| 47 | + return; |
|
| 48 | + } |
|
| 47 | 49 | if( $this->field['is_raw'] ) { |
| 48 | 50 | return glsr( Builder::class )->{$this->field['type']}( $this->field ); |
| 49 | 51 | } |
@@ -143,7 +145,9 @@ discard block |
||
| 143 | 145 | */ |
| 144 | 146 | protected function getFieldErrors() |
| 145 | 147 | { |
| 146 | - if( empty( $this->field['errors'] ) || !is_array( $this->field['errors'] ))return; |
|
| 148 | + if( empty( $this->field['errors'] ) || !is_array( $this->field['errors'] )) { |
|
| 149 | + return; |
|
| 150 | + } |
|
| 147 | 151 | $errors = array_reduce( $this->field['errors'], function( $carry, $error ) { |
| 148 | 152 | return $carry.glsr( Builder::class )->span( $error, ['class' => 'glsr-field-error'] ); |
| 149 | 153 | }); |
@@ -170,7 +174,9 @@ discard block |
||
| 170 | 174 | 'name', 'type', |
| 171 | 175 | ]; |
| 172 | 176 | foreach( $requiredValues as $value ) { |
| 173 | - if( isset( $this->field[$value] ))continue; |
|
| 177 | + if( isset( $this->field[$value] )) { |
|
| 178 | + continue; |
|
| 179 | + } |
|
| 174 | 180 | $missingValues[] = $value; |
| 175 | 181 | $this->field['is_valid'] = false; |
| 176 | 182 | } |
@@ -187,7 +193,9 @@ discard block |
||
| 187 | 193 | */ |
| 188 | 194 | protected function normalize() |
| 189 | 195 | { |
| 190 | - if( !$this->isFieldValid() )return; |
|
| 196 | + if( !$this->isFieldValid() ) { |
|
| 197 | + return; |
|
| 198 | + } |
|
| 191 | 199 | $this->field['path'] = $this->field['name']; |
| 192 | 200 | $className = glsr( Helper::class )->buildClassName( $this->field['type'], __NAMESPACE__.'\Fields' ); |
| 193 | 201 | if( class_exists( $className )) { |
@@ -205,7 +213,9 @@ discard block |
||
| 205 | 213 | */ |
| 206 | 214 | protected function normalizeFieldId() |
| 207 | 215 | { |
| 208 | - if( isset( $this->field['id'] ) || $this->field['is_raw'] )return; |
|
| 216 | + if( isset( $this->field['id'] ) || $this->field['is_raw'] ) { |
|
| 217 | + return; |
|
| 218 | + } |
|
| 209 | 219 | $this->field['id'] = glsr( Helper::class )->convertPathToId( |
| 210 | 220 | $this->field['path'], |
| 211 | 221 | $this->getFieldPrefix() |
@@ -73,7 +73,9 @@ discard block |
||
| 73 | 73 | foreach( $this->rules as $attribute => $rules ) { |
| 74 | 74 | foreach( $rules as $rule ) { |
| 75 | 75 | $this->validateAttribute( $attribute, $rule ); |
| 76 | - if( $this->shouldStopValidating( $attribute ))break; |
|
| 76 | + if( $this->shouldStopValidating( $attribute )) { |
|
| 77 | + break; |
|
| 78 | + } |
|
| 77 | 79 | } |
| 78 | 80 | } |
| 79 | 81 | return $this->errors; |
@@ -89,7 +91,9 @@ discard block |
||
| 89 | 91 | public function validateAttribute( $attribute, $rule ) |
| 90 | 92 | { |
| 91 | 93 | list( $rule, $parameters ) = $this->parseRule( $rule ); |
| 92 | - if( $rule == '' )return; |
|
| 94 | + if( $rule == '' ) { |
|
| 95 | + return; |
|
| 96 | + } |
|
| 93 | 97 | $value = $this->getValue( $attribute ); |
| 94 | 98 | if( !method_exists( $this, $method = 'validate'.$rule )) { |
| 95 | 99 | throw new BadMethodCallException( "Method [$method] does not exist." ); |
@@ -158,7 +162,9 @@ discard block |
||
| 158 | 162 | */ |
| 159 | 163 | protected function getRule( $attribute, $rules ) |
| 160 | 164 | { |
| 161 | - if( !array_key_exists( $attribute, $this->rules ))return; |
|
| 165 | + if( !array_key_exists( $attribute, $this->rules )) { |
|
| 166 | + return; |
|
| 167 | + } |
|
| 162 | 168 | $rules = (array) $rules; |
| 163 | 169 | foreach( $this->rules[$attribute] as $rule ) { |
| 164 | 170 | list( $rule, $parameters ) = $this->parseRule( $rule ); |
@@ -318,7 +324,9 @@ discard block |
||
| 318 | 324 | $message = isset( $strings[$key] ) |
| 319 | 325 | ? $strings[$key] |
| 320 | 326 | : false; |
| 321 | - if( !$message )return; |
|
| 327 | + if( !$message ) { |
|
| 328 | + return; |
|
| 329 | + } |
|
| 322 | 330 | if( method_exists( $this, $method = 'replace'.$rule )) { |
| 323 | 331 | $message = $this->$method( $message, $parameters ); |
| 324 | 332 | } |
@@ -102,7 +102,9 @@ discard block |
||
| 102 | 102 | protected function sendNotification( $postId ) |
| 103 | 103 | { |
| 104 | 104 | $notificationType = glsr( OptionManager::class )->get( 'settings.general.notification' ); |
| 105 | - if( !in_array( $notificationType, ['default','custom','webhook'] ))return; |
|
| 105 | + if( !in_array( $notificationType, ['default','custom','webhook'] )) { |
|
| 106 | + return; |
|
| 107 | + } |
|
| 106 | 108 | $assignedToTitle = get_the_title( (int)$this->command->assigned_to ); |
| 107 | 109 | $notificationSubject = _nx( |
| 108 | 110 | 'New %s-star review', |
@@ -150,7 +152,9 @@ discard block |
||
| 150 | 152 | */ |
| 151 | 153 | protected function sendWebhookNotification( array $args ) |
| 152 | 154 | { |
| 153 | - if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )))return; |
|
| 155 | + if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' ))) { |
|
| 156 | + return; |
|
| 157 | + } |
|
| 154 | 158 | $notification = $this->createWebhookNotification( $args ); |
| 155 | 159 | $result = wp_remote_post( $endpoint, [ |
| 156 | 160 | 'blocking' => false, |