Passed
Push — master ( 4224ed...e7f15b )
by Paul
04:26
created
plugin/Modules/Blacklist.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@
 block discarded – undo
37 37
 		$lines = explode( "\n", $blacklist );
38 38
 		foreach( (array) $lines as $line ) {
39 39
 			$line = trim( $line );
40
-			if( empty( $line ) || 256 < strlen( $line ))continue;
40
+			if( empty( $line ) || 256 < strlen( $line )) {
41
+				continue;
42
+			}
41 43
 			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ));
42 44
 			if( preg_match( $pattern, $target )) {
43 45
 				return true;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 	 */
12 12
 	public function isBlacklisted( array $review )
13 13
 	{
14
-		$target = implode( "\n", array_filter([
14
+		$target = implode( "\n", array_filter( [
15 15
 			$review['name'],
16 16
 			$review['content'],
17 17
 			$review['email'],
18 18
 			$review['ip_address'],
19 19
 			$review['title'],
20
-		]));
21
-		return (bool) apply_filters( 'site-reviews/blacklist/is-blacklisted',
20
+		] ) );
21
+		return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted',
22 22
 			$this->check( $target ),
23 23
 			$review
24 24
 		);
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	protected function check( $target )
32 32
 	{
33
-		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ));
34
-		if( empty( $blacklist )) {
33
+		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ) );
34
+		if( empty($blacklist) ) {
35 35
 			return false;
36 36
 		}
37 37
 		$lines = explode( "\n", $blacklist );
38
-		foreach( (array) $lines as $line ) {
38
+		foreach( (array)$lines as $line ) {
39 39
 			$line = trim( $line );
40
-			if( empty( $line ) || 256 < strlen( $line ))continue;
41
-			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ));
42
-			if( preg_match( $pattern, $target )) {
40
+			if( empty($line) || 256 < strlen( $line ) )continue;
41
+			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ) );
42
+			if( preg_match( $pattern, $target ) ) {
43 43
 				return true;
44 44
 			}
45 45
 		}
Please login to merge, or discard this patch.
plugin/Modules/Notice.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@  discard block
 block discarded – undo
15 15
 	 */
16 16
 	public function add( $type, $message, array $args = [] )
17 17
 	{
18
-		if( empty( array_filter( [$message, $type] )))return;
18
+		if( empty( array_filter( [$message, $type] ))) {
19
+			return;
20
+		}
19 21
 		$args['message'] = $message;
20 22
 		$args['type'] = $type;
21 23
 		add_settings_error( Application::ID, '', json_encode( $this->normalize( $args )));
@@ -56,7 +58,9 @@  discard block
 block discarded – undo
56 58
 		$notices = array_map( 'unserialize',
57 59
 			array_unique( array_map( 'serialize', get_settings_errors( Application::ID )))
58 60
 		);
59
-		if( empty( $notices ))return;
61
+		if( empty( $notices )) {
62
+			return;
63
+		}
60 64
 		return array_reduce( $notices, function( $carry, $notice ) {
61 65
 			return $carry.$this->buildNotice( json_decode( $notice['message'], true ));
62 66
 		});
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
 	 */
16 16
 	public function add( $type, $message, array $args = [] )
17 17
 	{
18
-		if( empty( array_filter( [$message, $type] )))return;
18
+		if( empty(array_filter( [$message, $type] )) )return;
19 19
 		$args['message'] = $message;
20 20
 		$args['type'] = $type;
21
-		add_settings_error( Application::ID, '', json_encode( $this->normalize( $args )));
21
+		add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ) ) );
22 22
 	}
23 23
 
24 24
 	/**
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 	public function get()
55 55
 	{
56 56
 		$notices = array_map( 'unserialize',
57
-			array_unique( array_map( 'serialize', get_settings_errors( Application::ID )))
57
+			array_unique( array_map( 'serialize', get_settings_errors( Application::ID ) ) )
58 58
 		);
59
-		if( empty( $notices ))return;
59
+		if( empty($notices) )return;
60 60
 		return array_reduce( $notices, function( $carry, $notice ) {
61
-			return $carry.$this->buildNotice( json_decode( $notice['message'], true ));
61
+			return $carry.$this->buildNotice( json_decode( $notice['message'], true ) );
62 62
 		});
63 63
 	}
64 64
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		}
80 80
 		return glsr( Builder::class )->div( $messages, [
81 81
 			'class' => $class,
82
-		]);
82
+		] );
83 83
 	}
84 84
 
85 85
 	/**
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 			'type' => '',
95 95
 		];
96 96
 		$args = shortcode_atts( $defaults, $args );
97
-		if( !in_array( $args['type'], ['error', 'warning', 'success'] )) {
97
+		if( !in_array( $args['type'], ['error', 'warning', 'success'] ) ) {
98 98
 			$args['type'] = 'success';
99 99
 		}
100 100
 		$args['messages'] = is_wp_error( $args['message'] )
101 101
 			? (array)$args['message']->get_error_message()
102 102
 			: (array)$args['message'];
103
-		unset( $args['message'] );
103
+		unset($args['message']);
104 104
 		return $args;
105 105
 	}
106 106
 }
Please login to merge, or discard this patch.
plugin/Modules/Akismet.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@  discard block
 block discarded – undo
30 30
 			// 'is_test' => 1,
31 31
 		];
32 32
 		foreach( $_SERVER as $key => $value ) {
33
-			if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ))continue;
33
+			if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] )) {
34
+				continue;
35
+			}
34 36
 			$submission[$key] = $value;
35 37
 		}
36 38
 		return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review ));
@@ -56,12 +58,16 @@  discard block
 block discarded – undo
56 58
 	{
57 59
 		$query = [];
58 60
 		foreach( $data as $key => $value ) {
59
-			if( is_array( $value ) || is_object( $value ))continue;
61
+			if( is_array( $value ) || is_object( $value )) {
62
+				continue;
63
+			}
60 64
 			if( $value === false ) {
61 65
 				$value = '0';
62 66
 			}
63 67
 			$value = trim( $value );
64
-			if( !strlen( $value ))continue;
68
+			if( !strlen( $value )) {
69
+				continue;
70
+			}
65 71
 			$query[] = urlencode( $key ).'='.urlencode( $value );
66 72
 		}
67 73
 		return implode( '&', $query );
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 			// 'is_test' => 1,
32 32
 		];
33 33
 		foreach( $_SERVER as $key => $value ) {
34
-			if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ))continue;
34
+			if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ) )continue;
35 35
 			$submission[$key] = $value;
36 36
 		}
37
-		return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review ));
37
+		return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review ) );
38 38
 	}
39 39
 
40 40
 	/**
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	{
58 58
 		$query = [];
59 59
 		foreach( $data as $key => $value ) {
60
-			if( is_array( $value ) || is_object( $value ))continue;
60
+			if( is_array( $value ) || is_object( $value ) )continue;
61 61
 			if( $value === false ) {
62 62
 				$value = '0';
63 63
 			}
64 64
 			$value = trim( $value );
65
-			if( !strlen( $value ))continue;
65
+			if( !strlen( $value ) )continue;
66 66
 			$query[] = urlencode( $key ).'='.urlencode( $value );
67 67
 		}
68 68
 		return implode( '&', $query );
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			|| !is_callable( ['Akismet', 'get_api_key'] )
78 78
 			|| !is_callable( ['Akismet', 'http_post'] )
79 79
 			? false
80
-			: (bool) AkismetPlugin::get_api_key();
80
+			: (bool)AkismetPlugin::get_api_key();
81 81
 		return apply_filters( 'site-reviews/akismet/is-active', $check );
82 82
 	}
83 83
 }
Please login to merge, or discard this patch.
plugin/Modules/Rating.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@  discard block
 block discarded – undo
63 63
 		$counts = array_fill_keys( [5,4,3,2,1], [] );
64 64
 		array_walk( $counts, function( &$count, $key ) use( $reviews ) {
65 65
 			$count = count( array_filter( $reviews, function( $review ) use( $key ) {
66
-				if( !isset( $review->rating ))return;
66
+				if( !isset( $review->rating )) {
67
+					return;
68
+				}
67 69
 				return $review->rating == $key;
68 70
 			}));
69 71
 		});
@@ -83,7 +85,9 @@  discard block
 block discarded – undo
83 85
 	public function getLowerBound( array $upDownRatings, $confidencePercentage = 95 )
84 86
 	{
85 87
 		$numRatings = count( $upDownRatings );
86
-		if( !$numRatings )return 0;
88
+		if( !$numRatings ) {
89
+			return 0;
90
+		}
87 91
 		$positiveRatings = count( array_filter( $upDownRatings, function( $value ) {
88 92
 			return $value > 0;
89 93
 		}));
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	{
51 51
 		$average = count( $reviews );
52 52
 		if( $average > 0 ) {
53
-			$average = round( $this->getTotal( $reviews ) / $average, intval( $roundBy ));
53
+			$average = round( $this->getTotal( $reviews ) / $average, intval( $roundBy ) );
54 54
 		}
55
-		return floatval( apply_filters( 'site-reviews/rating/average', $average, $reviews ));
55
+		return floatval( apply_filters( 'site-reviews/rating/average', $average, $reviews ) );
56 56
 	}
57 57
 
58 58
 	/**
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function getCounts( array $reviews )
62 62
 	{
63
-		$counts = array_fill_keys( [5,4,3,2,1], [] );
64
-		array_walk( $counts, function( &$count, $key ) use( $reviews ) {
65
-			$count = count( array_filter( $reviews, function( $review ) use( $key ) {
66
-				if( !isset( $review->rating ))return;
63
+		$counts = array_fill_keys( [5, 4, 3, 2, 1], [] );
64
+		array_walk( $counts, function( &$count, $key ) use($reviews) {
65
+			$count = count( array_filter( $reviews, function( $review ) use($key) {
66
+				if( !isset($review->rating) )return;
67 67
 				return $review->rating == $key;
68
-			}));
68
+			}) );
69 69
 		});
70 70
 		return $counts;
71 71
 	}
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 		if( !$numRatings )return 0;
87 87
 		$positiveRatings = count( array_filter( $upDownRatings, function( $value ) {
88 88
 			return $value > 0;
89
-		}));
89
+		}) );
90 90
 		$z = static::CONFIDENCE_LEVEL_Z_SCORES[$confidencePercentage];
91 91
 		$phat = 1 * $positiveRatings / $numRatings;
92
-		return ( $phat + $z * $z / ( 2 * $numRatings ) - $z * sqrt(( $phat * ( 1 - $phat ) + $z * $z / ( 4 * $numRatings )) / $numRatings )) / ( 1 + $z * $z / $numRatings );
92
+		return ($phat + $z * $z / (2 * $numRatings) - $z * sqrt( ($phat * (1 - $phat) + $z * $z / (4 * $numRatings)) / $numRatings )) / (1 + $z * $z / $numRatings);
93 93
 	}
94 94
 
95 95
 	/**
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	public function getPercentages( array $reviews )
109 109
 	{
110 110
 		$counts = $this->getCounts( $reviews );
111
-		array_walk( $counts, function( &$count, $rating ) use( $counts ) {
111
+		array_walk( $counts, function( &$count, $rating ) use($counts) {
112 112
 			$total = array_sum( $counts );
113
-			$count = !empty( $total ) && !empty( $counts[$rating] )
113
+			$count = !empty($total) && !empty($counts[$rating])
114 114
 				? $counts[$rating] / array_sum( $counts ) * 100
115 115
 				: 0;
116 116
 		});
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 			$this->getRankingUsingImdb( $reviews ),
128 128
 			$reviews,
129 129
 			$this
130
-		));
130
+		) );
131 131
 	}
132 132
 
133 133
 	/**
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 		$bayesMinimal = 10; // confidence
158 158
 		// Represents a prior (your prior opinion without data) for the average star rating. A higher prior also means a higher margin for error.
159 159
 		// This could also be the average score of all items instead of a fixed value.
160
-		$bayesMean = ( $confidencePercentage / 100 ) * static::MAX_RATING; // prior, 70% = 3.5
160
+		$bayesMean = ($confidencePercentage / 100) * static::MAX_RATING; // prior, 70% = 3.5
161 161
 		$numOfReviews = count( $reviews );
162 162
 		$avgRating = $this->getAverage( $reviews );
163 163
 		return $avgRating > 0
164
-			? (( $bayesMinimal * $bayesMean ) + ( $avgRating * $numOfReviews )) / ( $bayesMinimal + $numOfReviews )
164
+			? (($bayesMinimal * $bayesMean) + ($avgRating * $numOfReviews)) / ($bayesMinimal + $numOfReviews)
165 165
 			: 0;
166 166
 	}
167 167
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		$weight = $this->getWeight( $ratingCounts, $ratingCountsSum );
183 183
 		$weightPow2 = $this->getWeight( $ratingCounts, $ratingCountsSum, true );
184 184
 		$zScore = static::CONFIDENCE_LEVEL_Z_SCORES[$confidencePercentage];
185
-		return $weight - $zScore * sqrt(( $weightPow2 - pow( $weight, 2 )) / ( $ratingCountsSum + 1 ));
185
+		return $weight - $zScore * sqrt( ($weightPow2 - pow( $weight, 2 )) / ($ratingCountsSum + 1) );
186 186
 	}
187 187
 
188 188
 	/**
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 		$remainders = array_column( $percentages, 'remainder' );
203 203
 		array_multisort( $remainders, SORT_DESC, SORT_STRING, $indexes, SORT_DESC, $percentages );
204 204
 		$i = 0;
205
-		if( array_sum( array_column( $percentages, 'percent' )) > 0 ) {
206
-			while( array_sum( array_column( $percentages, 'percent' )) < $target ) {
205
+		if( array_sum( array_column( $percentages, 'percent' ) ) > 0 ) {
206
+			while( array_sum( array_column( $percentages, 'percent' ) ) < $target ) {
207 207
 				$percentages[$i]['percent']++;
208 208
 				$i++;
209 209
 			}
210 210
 		}
211 211
 		array_multisort( $indexes, SORT_DESC, $percentages );
212
-		return array_combine( $indexes, array_column( $percentages, 'percent' ));
212
+		return array_combine( $indexes, array_column( $percentages, 'percent' ) );
213 213
 	}
214 214
 
215 215
 	/**
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 	protected function getWeight( array $ratingCounts, $ratingCountsSum, $powerOf2 = false )
221 221
 	{
222 222
 		return array_reduce( array_keys( $ratingCounts ),
223
-			function( $count, $rating ) use( $ratingCounts, $ratingCountsSum, $powerOf2 ) {
223
+			function( $count, $rating ) use($ratingCounts, $ratingCountsSum, $powerOf2) {
224 224
 				$ratingLevel = $powerOf2 ? pow( $rating, 2 ) : $rating;
225
-				return $count + ( $ratingLevel * ( $ratingCounts[$rating] + 1 )) / $ratingCountsSum;
225
+				return $count + ($ratingLevel * ($ratingCounts[$rating] + 1)) / $ratingCountsSum;
226 226
 			}
227 227
 		);
228 228
 	}
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsSummaryWidget.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,22 +20,22 @@  discard block
 block discarded – undo
20 20
 			'class' => 'widefat',
21 21
 			'label' => __( 'Title', 'site-reviews' ),
22 22
 			'name' => 'title',
23
-		]);
23
+		] );
24 24
 		if( count( glsr()->reviewTypes ) > 1 ) {
25 25
 			$this->renderField( 'select', [
26 26
 				'class' => 'widefat',
27 27
 				'label' => __( 'Which type of review would you like to use?', 'site-reviews' ),
28 28
 				'name' => 'type',
29 29
 				'options' => ['' => __( 'All review types', 'site-reviews' )] + glsr()->reviewTypes,
30
-			]);
30
+			] );
31 31
 		}
32
-		if( !empty( $terms )) {
32
+		if( !empty($terms) ) {
33 33
 			$this->renderField( 'select', [
34 34
 				'class' => 'widefat',
35 35
 				'label' => __( 'Limit summary to this category', 'site-reviews' ),
36 36
 				'name' => 'category',
37 37
 				'options' => ['' => __( 'All Categories', 'site-reviews' )] + $terms,
38
-			]);
38
+			] );
39 39
 		}
40 40
 		$this->renderField( 'text', [
41 41
 			'class' => 'widefat',
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 			'description' => sprintf( __( "Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews' ), '<code>post_id</code>' ),
44 44
 			'label' => __( 'Limit summary to reviews assigned to a page/post ID', 'site-reviews' ),
45 45
 			'name' => 'assigned_to',
46
-		]);
46
+		] );
47 47
 		$this->renderField( 'text', [
48 48
 			'class' => 'widefat',
49 49
 			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
50 50
 			'name' => 'class',
51
-		]);
51
+		] );
52 52
 		$this->renderField( 'checkbox', [
53 53
 			'name' => 'hide',
54 54
 			'options' => [
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 				'summary' => __( 'Hide the summary text?', 'site-reviews' ),
59 59
 				'if_empty' => __( 'Hide the summary if no reviews are found?', 'site-reviews' ),
60 60
 			],
61
-		]);
61
+		] );
62 62
 	}
63 63
 
64 64
 	/**
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsFormWidget.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,30 +20,30 @@  discard block
 block discarded – undo
20 20
 			'class' => 'widefat',
21 21
 			'label' => __( 'Title', 'site-reviews' ),
22 22
 			'name' => 'title',
23
-		]);
23
+		] );
24 24
 		$this->renderField( 'textarea', [
25 25
 			'class' => 'widefat',
26 26
 			'label' => __( 'Description', 'site-reviews' ),
27 27
 			'name' => 'description',
28
-		]);
28
+		] );
29 29
 		$this->renderField( 'select', [
30 30
 			'class' => 'widefat',
31 31
 			'label' => __( 'Automatically assign a category', 'site-reviews' ),
32 32
 			'name' => 'category',
33 33
 			'options' => ['' => __( 'Do not assign a category', 'site-reviews' )] + $terms,
34
-		]);
34
+		] );
35 35
 		$this->renderField( 'text', [
36 36
 			'class' => 'widefat',
37 37
 			'default' => '',
38 38
 			'description' => sprintf( __( 'You may also enter %s to assign to the current post.', 'site-reviews' ), '<code>post_id</code>' ),
39 39
 			'label' => __( 'Assign reviews to a custom page/post ID', 'site-reviews' ),
40 40
 			'name' => 'assign_to',
41
-		]);
41
+		] );
42 42
 		$this->renderField( 'text', [
43 43
 			'class' => 'widefat',
44 44
 			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
45 45
 			'name' => 'class',
46
-		]);
46
+		] );
47 47
 		$this->renderField( 'checkbox', [
48 48
 			'name' => 'hide',
49 49
 			'options' => [
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 				'terms' => __( 'Hide the terms field', 'site-reviews' ),
53 53
 				'title' => __( 'Hide the title field', 'site-reviews' ),
54 54
 			],
55
-		]);
55
+		] );
56 56
 	}
57 57
 
58 58
 	/**
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsWidget.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 			'class' => 'widefat',
21 21
 			'label' => __( 'Title', 'site-reviews' ),
22 22
 			'name' => 'title',
23
-		]);
23
+		] );
24 24
 		$this->renderField( 'number', [
25 25
 			'class' => 'small-text',
26 26
 			'default' => 5,
27 27
 			'label' => __( 'How many reviews would you like to display?', 'site-reviews' ),
28 28
 			'max' => 100,
29 29
 			'name' => 'count',
30
-		]);
30
+		] );
31 31
 		$this->renderField( 'select', [
32 32
 			'label' => __( 'What is the minimum rating to display?', 'site-reviews' ),
33 33
 			'name' => 'rating',
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 				'2' => sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ),
39 39
 				'1' => sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ),
40 40
 			],
41
-		]);
41
+		] );
42 42
 		if( count( glsr()->reviewTypes ) > 1 ) {
43 43
 			$this->renderField( 'select', [
44 44
 				'class' => 'widefat',
45 45
 				'label' => __( 'Which reviews would you like to display?', 'site-reviews' ),
46 46
 				'name' => 'display',
47 47
 				'options' => ['' => __( 'All Reviews', 'site-reviews' )] + glsr()->reviewTypes,
48
-			]);
48
+			] );
49 49
 		}
50
-		if( !empty( $terms )) {
50
+		if( !empty($terms) ) {
51 51
 			$this->renderField( 'select', [
52 52
 				'class' => 'widefat',
53 53
 				'label' => __( 'Limit reviews to this category', 'site-reviews' ),
54 54
 				'name' => 'category',
55 55
 				'options' => ['' => __( 'All Categories', 'site-reviews' )] + $terms,
56
-			]);
56
+			] );
57 57
 		}
58 58
 		$this->renderField( 'text', [
59 59
 			'class' => 'widefat',
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 			'description' => sprintf( __( "Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews' ), '<code>post_id</code>' ),
62 62
 			'label' => __( 'Limit reviews to those assigned to this page/post ID', 'site-reviews' ),
63 63
 			'name' => 'assigned_to',
64
-		]);
64
+		] );
65 65
 		$this->renderField( 'text', [
66 66
 			'class' => 'widefat',
67 67
 			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
68 68
 			'name' => 'class',
69
-		]);
69
+		] );
70 70
 		$this->renderField( 'checkbox', [
71 71
 			'name' => 'hide',
72 72
 			'options' => [
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 				'response' => __( 'Hide the review response?', 'site-reviews' ),
78 78
 				'title' => __( 'Hide the review title?', 'site-reviews' ),
79 79
 			],
80
-		]);
80
+		] );
81 81
 	}
82 82
 
83 83
 	/**
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function update( $newInstance, $oldInstance )
89 89
 	{
90
-		if( !is_numeric( $newInstance['count'] )) {
90
+		if( !is_numeric( $newInstance['count'] ) ) {
91 91
 			$newInstance['count'] = 10;
92 92
 		}
93
-		$newInstance['count'] = min( 50, max( 0, intval( $newInstance['count'] )));
93
+		$newInstance['count'] = min( 50, max( 0, intval( $newInstance['count'] ) ) );
94 94
 		return parent::update( $newInstance, $oldInstance );
95 95
 	}
96 96
 
Please login to merge, or discard this patch.
plugin/Widgets/Widget.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@  discard block
 block discarded – undo
15 15
 	public function __construct( $idBase, $name, $values )
16 16
 	{
17 17
 		$controlOptions = $widgetOptions = [];
18
-		if( isset( $values['class'] )) {
18
+		if( isset($values['class']) ) {
19 19
 			$widgetOptions['classname'] = $values['class'];
20 20
 		}
21
-		if( isset( $values['description'] )) {
21
+		if( isset($values['description']) ) {
22 22
 			$widgetOptions['description'] = $values['description'];
23 23
 		}
24
-		if( isset( $values['width'] )) {
24
+		if( isset($values['width']) ) {
25 25
 			$controlOptions['width'] = $values['width'];
26 26
 		}
27 27
 		parent::__construct( $idBase, $name, $widgetOptions, $controlOptions );
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 	protected function renderField( $tag, array $args = [] )
35 35
 	{
36 36
 		$args = $this->normalizeFieldAttributes( $tag, $args );
37
-		$field = glsr( Builder::class )->{$tag}( $args['name'], $args );
37
+		$field = glsr( Builder::class )->{$tag}($args['name'], $args);
38 38
 		echo glsr( Builder::class )->div( $field, [
39 39
 			'class' => 'glsr-field',
40
-		]);
40
+		] );
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	protected function normalizeFieldAttributes( $tag, array $args )
48 48
 	{
49
-		if( empty( $args['value'] )) {
49
+		if( empty($args['value']) ) {
50 50
 			$args['value'] = $this->widgetArgs[$args['name']];
51 51
 		}
52
-		if( empty( $this->widgetArgs['options'] ) && in_array( $tag, ['checkbox', 'radio'] )) {
52
+		if( empty($this->widgetArgs['options']) && in_array( $tag, ['checkbox', 'radio'] ) ) {
53 53
 			$args['checked'] = in_array( $args['value'], (array)$this->widgetArgs[$args['name']] );
54 54
 		}
55 55
 		$args['id'] = $this->get_field_id( $args['name'] );
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsFormButton.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 		return [[
16 16
 			'type' => 'container',
17 17
 			'html' => '<p class="strong">'.esc_html__( 'All settings are optional.', 'site-reviews' ).'</p>',
18
-		],[
18
+		], [
19 19
 			'label' => esc_html__( 'Title', 'site-reviews' ),
20 20
 			'name' => 'title',
21 21
 			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
22 22
 			'type' => 'textbox',
23
-		],[
23
+		], [
24 24
 			'label' => esc_html__( 'Description', 'site-reviews' ),
25 25
 			'minHeight' => 60,
26 26
 			'minWidth' => 240,
@@ -35,29 +35,29 @@  discard block
 block discarded – undo
35 35
 			'name' => 'assign_to',
36 36
 			'tooltip' => __( 'Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews' ),
37 37
 			'type' => 'textbox',
38
-		],[
38
+		], [
39 39
 			'label' => esc_html__( 'Classes', 'site-reviews' ),
40 40
 			'name' => 'class',
41 41
 			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
42 42
 			'type' => 'textbox',
43
-		],[
43
+		], [
44 44
 			'columns' => 2,
45 45
 			'items' => [[
46 46
 				'name' => 'hide_email',
47 47
 				'text' => esc_html__( 'Email', 'site-reviews' ),
48 48
 				'tooltip' => __( 'Hide the email field?', 'site-reviews' ),
49 49
 				'type' => 'checkbox',
50
-			],[
50
+			], [
51 51
 				'name' => 'hide_name',
52 52
 				'text' => esc_html__( 'Name', 'site-reviews' ),
53 53
 				'tooltip' => __( 'Hide the name field?', 'site-reviews' ),
54 54
 				'type' => 'checkbox',
55
-			],[
55
+			], [
56 56
 				'name' => 'hide_terms',
57 57
 				'text' => esc_html__( 'Terms', 'site-reviews' ),
58 58
 				'tooltip' => __( 'Hide the terms field?', 'site-reviews' ),
59 59
 				'type' => 'checkbox',
60
-			],[
60
+			], [
61 61
 				'name' => 'hide_title',
62 62
 				'text' => esc_html__( 'Title', 'site-reviews' ),
63 63
 				'tooltip' => __( 'Hide the title field?', 'site-reviews' ),
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			'layout' => 'grid',
68 68
 			'spacing' => 5,
69 69
 			'type' => 'container',
70
-		],[
70
+		], [
71 71
 			'hidden' => true,
72 72
 			'name' => 'id',
73 73
 			'type' => 'textbox',
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	public function getTerms()
81 81
 	{
82 82
 		$terms = glsr( Database::class )->getTerms();
83
-		if( empty( $terms )) {
83
+		if( empty($terms) ) {
84 84
 			return [];
85 85
 		}
86 86
 		return [
Please login to merge, or discard this patch.