Passed
Push — master ( 65c96d...e99773 )
by Paul
08:33 queued 04:19
created
plugin/Modules/Html/Partials/SiteReviewsForm.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -85,7 +85,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
compatibility.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@
 block discarded – undo
8 8
  * @see https://www.elegantthemes.com/gallery/divi/
9 9
  */
10 10
 add_action( 'site-reviews/customize/divi', function( $instance ) {
11
-	if( $instance->tag != 'label' || $instance->args['type'] != 'checkbox' )return;
11
+	if( $instance->tag != 'label' || $instance->args['type'] != 'checkbox' ) {
12
+		return;
13
+	}
12 14
 	$instance->args['text'] = '<i></i>'.$instance->args['text'];
13 15
 });
14 16
 
Please login to merge, or discard this patch.
plugin/Modules/Upgrader.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 		$filenames = [];
17 17
 		$iterator = new DirectoryIterator( dirname( __FILE__ ).'/Upgrader' );
18 18
 		foreach( $iterator as $fileinfo ) {
19
-			if( !$fileinfo->isFile() )continue;
19
+			if( !$fileinfo->isFile() ) {
20
+				continue;
21
+			}
20 22
 			$filenames[] = $fileinfo->getFilename();
21 23
 		}
22 24
 		natsort( $filenames );
@@ -24,7 +26,9 @@  discard block
 block discarded – undo
24 26
 			$className = str_replace( '.php', '', $file );
25 27
 			$version = str_replace( ['Upgrade_', '_'], ['', '.'], $className );
26 28
 			$versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions
27
-			if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return;
29
+			if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' )) {
30
+				return;
31
+			}
28 32
 			glsr( 'Modules\\Upgrader\\'.$className );
29 33
 			glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix );
30 34
 		});
@@ -45,7 +49,9 @@  discard block
 block discarded – undo
45 49
 	 */
46 50
 	public function setReviewCounts()
47 51
 	{
48
-		if( !empty( glsr( OptionManager::class )->get( 'last_review_count' )))return;
52
+		if( !empty( glsr( OptionManager::class )->get( 'last_review_count' ))) {
53
+			return;
54
+		}
49 55
 		add_action( 'admin_init', function() {
50 56
 			glsr( AdminController::class )->routerCountReviews( false );
51 57
 			glsr_log()->info( __( 'Calculated rating counts.', 'site-reviews' ));
Please login to merge, or discard this patch.
plugin/Controllers/ReviewController.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 	{
26 26
 		sort( $termIds );
27 27
 		sort( $oldTermIds );
28
-		if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId ))return;
28
+		if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId )) {
29
+			return;
30
+		}
29 31
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
30 32
 		$ignoredTerms = array_intersect( $oldTermIds, $termIds );
31 33
 		if( $review->term_ids = array_diff( $oldTermIds, $ignoredTerms )) {
@@ -52,7 +54,9 @@  discard block
 block discarded – undo
52 54
 	 */
53 55
 	public function onBeforeDelete( $postId )
54 56
 	{
55
-		if( !$this->isReviewPostId( $postId ))return;
57
+		if( !$this->isReviewPostId( $postId )) {
58
+			return;
59
+		}
56 60
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
57 61
 		glsr( CountsManager::class )->decrease( $review );
58 62
 	}
@@ -69,9 +73,13 @@  discard block
 block discarded – undo
69 73
 	{
70 74
 		if( !$this->isReviewPostId( $postId )
71 75
 			|| !in_array( $metaKey, ['assigned_to', 'rating', 'review_type'] )
72
-		)return;
76
+		) {
77
+			return;
78
+		}
73 79
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
74
-		if( $review->$metaKey == $metaValue )return;
80
+		if( $review->$metaKey == $metaValue ) {
81
+			return;
82
+		}
75 83
 		$method = glsr( Helper::class )->buildMethodName( $metaKey, 'onBeforeChange' );
76 84
 		call_user_func( [$this, $method], $review, $metaValue );
77 85
 	}
@@ -117,7 +125,9 @@  discard block
 block discarded – undo
117 125
 	 */
118 126
 	public function onChangeStatus( $newStatus, $oldStatus, WP_Post $post )
119 127
 	{
120
-		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ))return;
128
+		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] )) {
129
+			return;
130
+		}
121 131
 		$review = glsr( ReviewManager::class )->single( get_post( $post->ID ));
122 132
 		if( $post->post_status == 'publish' ) {
123 133
 			glsr( CountsManager::class )->increase( $review );
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Customization.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
plugin/Modules/Schema.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
views/partials/editor/review.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,10 @@
 block discarded – undo
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">
Please login to merge, or discard this patch.
plugin/Modules/Polylang.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
plugin/Database/CountsManager.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function decreasePostCounts( Review $review )
76 76
 	{
77
-		if( empty( $counts = $this->getPostCounts( $review->assigned_to )))return;
77
+		if( empty( $counts = $this->getPostCounts( $review->assigned_to ))) {
78
+			return;
79
+		}
78 80
 		$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
79 81
 		$this->setPostCounts( $review->assigned_to, $counts );
80 82
 	}
@@ -85,7 +87,9 @@  discard block
 block discarded – undo
85 87
 	public function decreaseTermCounts( Review $review )
86 88
 	{
87 89
 		foreach( $review->term_ids as $termId ) {
88
-			if( empty( $counts = $this->getTermCounts( $termId )))continue;
90
+			if( empty( $counts = $this->getTermCounts( $termId ))) {
91
+				continue;
92
+			}
89 93
 			$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
90 94
 			$this->setTermCounts( $termId, $counts );
91 95
 		}
@@ -107,7 +111,9 @@  discard block
 block discarded – undo
107 111
 			'min' => Rating::MIN_RATING,
108 112
 		]);
109 113
 		foreach( $counts as $index => &$num ) {
110
-			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue;
114
+			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] )) {
115
+				continue;
116
+			}
111 117
 			$num = 0;
112 118
 		}
113 119
 		return $counts;
@@ -194,7 +200,9 @@  discard block
 block discarded – undo
194 200
 	 */
195 201
 	public function increasePostCounts( Review $review )
196 202
 	{
197
-		if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return;
203
+		if( !( get_post( $review->assigned_to ) instanceof WP_Post )) {
204
+			return;
205
+		}
198 206
 		$counts = $this->getPostCounts( $review->assigned_to );
199 207
 		$counts = empty( $counts )
200 208
 			? $this->buildPostCounts( $review->assigned_to )
@@ -243,7 +251,9 @@  discard block
 block discarded – undo
243 251
 	 */
244 252
 	public function setTermCounts( $termId, array $reviewCounts )
245 253
 	{
246
-		if( !term_exists( $termId ))return;
254
+		if( !term_exists( $termId )) {
255
+			return;
256
+		}
247 257
 		$ratingCounts = $this->flatten( $reviewCounts );
248 258
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
249 259
 		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
@@ -261,7 +271,9 @@  discard block
 block discarded – undo
261 271
 		while( $reviews = $this->queryReviews( $args, $lastPostId, $limit )) {
262 272
 			$types = array_keys( array_flip( array_column( $reviews, 'type' )));
263 273
 			foreach( $types as $type ) {
264
-				if( isset( $counts[$type] ))continue;
274
+				if( isset( $counts[$type] )) {
275
+					continue;
276
+				}
265 277
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
266 278
 			}
267 279
 			foreach( $reviews as $review ) {
@@ -313,7 +325,9 @@  discard block
 block discarded – undo
313 325
 		}
314 326
 		foreach( $reviewCounts as &$counts ) {
315 327
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
316
-				if( isset( $counts[$index] ))continue;
328
+				if( isset( $counts[$index] )) {
329
+					continue;
330
+				}
317 331
 				$counts[$index] = 0;
318 332
 			}
319 333
 			ksort( $counts );
Please login to merge, or discard this patch.