Passed
Push — hotfix/fix-counts ( 0ee906...e9420b )
by Paul
03:57
created
plugin/Controllers/TaxonomyController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@
 block discarded – undo
35 35
 	 */
36 36
 	public function renderTaxonomyFilter()
37 37
 	{
38
-		if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ))return;
38
+		if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY )) {
39
+			return;
40
+		}
39 41
 		echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [
40 42
 			'class' => 'screen-reader-text',
41 43
 			'for' => Application::TAXONOMY,
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -108,12 +108,16 @@
 block discarded – undo
108 108
 	public function renderTinymceButton( $editorId )
109 109
 	{
110 110
 		$allowedEditors = apply_filters( 'site-reviews/tinymce/editor-ids', ['content'], $editorId );
111
-		if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors ))return;
111
+		if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors )) {
112
+			return;
113
+		}
112 114
 		$shortcodes = [];
113 115
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
114 116
 			$shortcodes[$shortcode] = $values;
115 117
 		}
116
-		if( empty( $shortcodes ))return;
118
+		if( empty( $shortcodes )) {
119
+			return;
120
+		}
117 121
 		glsr()->render( 'partials/editor/tinymce', [
118 122
 			'shortcodes' => $shortcodes,
119 123
 		]);
Please login to merge, or discard this patch.
plugin/Handlers/ChangeStatus.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,9 @@
 block discarded – undo
65 65
 		$avail_post_stati = get_available_post_statuses( Application::POST_TYPE );
66 66
 		$table = new \WP_Posts_List_Table( ['screen' => $hookName] );
67 67
 		$views = apply_filters( 'views_'.$hookName, $table->get_views() ); // uses compat get_views()
68
-		if( empty( $views ))return;
68
+		if( empty( $views )) {
69
+			return;
70
+		}
69 71
 		foreach( $views as $class => $view ) {
70 72
 			$views[$class] = "\t<li class='$class'>$view";
71 73
 		}
Please login to merge, or discard this patch.
compatibility.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 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
 
@@ -20,9 +22,13 @@  discard block
 block discarded – undo
20 22
  * @see https://wordpress.org/plugins/wp-super-cache/
21 23
  */
22 24
 add_action( 'site-reviews/review/created', function( $review, $request ) {
23
-	if( !function_exists( 'wp_cache_post_change' ))return;
25
+	if( !function_exists( 'wp_cache_post_change' )) {
26
+		return;
27
+	}
24 28
 	wp_cache_post_change( $request->post_id );
25
-	if( empty( $review->assigned_to ) || $review->assigned_to == $request->post_id )return;
29
+	if( empty( $review->assigned_to ) || $review->assigned_to == $request->post_id ) {
30
+		return;
31
+	}
26 32
 	wp_cache_post_change( $review->assigned_to );
27 33
 }, 10, 2 );
28 34
 
Please login to merge, or discard this patch.
plugin/Shortcodes/TinymcePopupGenerator.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -56,9 +56,13 @@  discard block
 block discarded – undo
56 56
 	protected function generateFields( array $fields )
57 57
 	{
58 58
 		$generatedFields = array_map( function( $field ) {
59
-			if( empty( $field ))return;
59
+			if( empty( $field )) {
60
+				return;
61
+			}
60 62
 			$field = $this->normalize( $field );
61
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
63
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ))) {
64
+				return;
65
+			}
62 66
 			return $this->$method( $field );
63 67
 		}, $fields );
64 68
 		return array_values( array_filter( $generatedFields ));
@@ -73,7 +77,9 @@  discard block
 block discarded – undo
73 77
 		if( !empty( $this->errors )) {
74 78
 			$errors = [];
75 79
 			foreach( $this->required as $name => $alert ) {
76
-				if( false !== array_search( $name, glsr_array_column( $fields, 'name' )))continue;
80
+				if( false !== array_search( $name, glsr_array_column( $fields, 'name' ))) {
81
+					continue;
82
+				}
77 83
 				$errors[] = $this->errors[$name];
78 84
 			}
79 85
 			$this->errors = $errors;
@@ -117,7 +123,9 @@  discard block
 block discarded – undo
117 123
 	 */
118 124
 	protected function normalizeContainer( array $field )
119 125
 	{
120
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
126
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field )) {
127
+			return;
128
+		}
121 129
 		$field['items'] = $this->generateFields( $field['items'] );
122 130
 		return $field;
123 131
 	}
@@ -127,7 +135,9 @@  discard block
 block discarded – undo
127 135
 	 */
128 136
 	protected function normalizeField( array $field, array $defaults )
129 137
 	{
130
-		if( !$this->validate( $field ))return;
138
+		if( !$this->validate( $field )) {
139
+			return;
140
+		}
131 141
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
132 142
 			return $value !== '';
133 143
 		});
@@ -148,7 +158,9 @@  discard block
 block discarded – undo
148 158
 			'type' => '',
149 159
 			'value' => '',
150 160
 		]);
151
-		if( !is_array( $listbox ))return;
161
+		if( !is_array( $listbox )) {
162
+			return;
163
+		}
152 164
 		if( !array_key_exists( '', $listbox['options'] )) {
153 165
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
154 166
 		}
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;
@@ -199,7 +205,9 @@  discard block
 block discarded – undo
199 205
 	 */
200 206
 	public function increasePostCounts( Review $review )
201 207
 	{
202
-		if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return;
208
+		if( !( get_post( $review->assigned_to ) instanceof WP_Post )) {
209
+			return;
210
+		}
203 211
 		$counts = $this->getPostCounts( $review->assigned_to );
204 212
 		$counts = empty( $counts )
205 213
 			? $this->buildPostCounts( $review->assigned_to )
@@ -249,7 +257,9 @@  discard block
 block discarded – undo
249 257
 	public function setTermCounts( $termId, array $reviewCounts )
250 258
 	{
251 259
 		$term = get_term( $termId, Application::TAXONOMY );
252
-		if( !isset( $term->term_id ))return;
260
+		if( !isset( $term->term_id )) {
261
+			return;
262
+		}
253 263
 		$ratingCounts = $this->flatten( $reviewCounts );
254 264
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
255 265
 		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
@@ -270,7 +280,9 @@  discard block
 block discarded – undo
270 280
 			$types = array_unique( array_merge( ['local'], $types ));
271 281
 			foreach( $types as $type ) {
272 282
 				$type = $this->normalizeType( $type );
273
-				if( isset( $counts[$type] ))continue;
283
+				if( isset( $counts[$type] )) {
284
+					continue;
285
+				}
274 286
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
275 287
 			}
276 288
 			foreach( $reviews as $review ) {
@@ -323,7 +335,9 @@  discard block
 block discarded – undo
323 335
 		}
324 336
 		foreach( $reviewCounts as &$counts ) {
325 337
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
326
-				if( isset( $counts[$index] ))continue;
338
+				if( isset( $counts[$index] )) {
339
+					continue;
340
+				}
327 341
 				$counts[$index] = 0;
328 342
 			}
329 343
 			ksort( $counts );
Please login to merge, or discard this patch.
plugin/Database.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 		if( empty( $assignedTo )) {
24 24
 			$assignedTo = get_post_meta( $postId, 'assigned_to', true );
25 25
 		}
26
-		if( empty( $assignedTo ))return;
26
+		if( empty( $assignedTo )) {
27
+			return;
28
+		}
27 29
 		$assignedPost = get_post( $assignedTo );
28 30
 		if( $assignedPost instanceof WP_Post && $assignedPost->ID != $postId ) {
29 31
 			return $assignedPost;
@@ -80,7 +82,9 @@  discard block
 block discarded – undo
80 82
 		$termIds = [];
81 83
 		foreach( $values as $value ) {
82 84
 			$term = get_term_by( $field, $value, Application::TAXONOMY );
83
-			if( !isset( $term->term_id ))continue;
85
+			if( !isset( $term->term_id )) {
86
+				continue;
87
+			}
84 88
 			$termIds[] = $term->term_id;
85 89
 		}
86 90
 		return $termIds;
@@ -127,7 +131,9 @@  discard block
 block discarded – undo
127 131
 		add_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2 );
128 132
 		$search = new WP_Query( $args );
129 133
 		remove_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500 );
130
-		if( !$search->have_posts() )return;
134
+		if( !$search->have_posts() ) {
135
+			return;
136
+		}
131 137
 		$results = '';
132 138
 		while( $search->have_posts() ) {
133 139
 			$search->the_post();
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsSummaryShortcode.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,8 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsSummaryShortcode extends Shortcode
8 8
 {
9
-	protected function hideOptions() {
9
+	protected function hideOptions()
10
+	{
10 11
 		return [
11 12
 			'rating' => __( 'Hide the rating', 'site-reviews' ),
12 13
 			'stars' => __( 'Hide the stars', 'site-reviews' ),
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsShortcode.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,8 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsShortcode extends Shortcode
8 8
 {
9
-	protected function hideOptions() {
9
+	protected function hideOptions()
10
+	{
10 11
 		return [
11 12
 			'title' => __( 'Hide the title', 'site-reviews' ),
12 13
 			'rating' => __( 'Hide the rating', 'site-reviews' ),
Please login to merge, or discard this patch.