Passed
Push — master ( 71fe18...341f99 )
by Paul
05:12
created
plugin/Modules/Html/Partials/SiteReviewsForm.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 				'response' => $this->buildResponse(),
66 66
 				'submit_button' => $this->buildSubmitButton().$this->buildRecaptcha(),
67 67
 			],
68
-		]);
68
+		] );
69 69
 	}
70 70
 
71 71
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			'context' => [
78 78
 				'text' => trim( $this->getLoginText().' '.$this->getRegisterText() ),
79 79
 			],
80
-		]);
80
+		] );
81 81
 	}
82 82
 
83 83
 	/**
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 	protected function buildRecaptcha()
87 87
 	{
88 88
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return;
89
-		return glsr( Builder::class )->div([
89
+		return glsr( Builder::class )->div( [
90 90
 			'class' => 'glsr-recaptcha-holder',
91 91
 			'data-badge' => glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ),
92
-			'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' )),
92
+			'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' ) ),
93 93
 			'data-size' => 'invisible',
94
-		]);
94
+		] );
95 95
 	}
96 96
 
97 97
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	protected function buildResponse()
101 101
 	{
102
-		$classes = !empty( $this->errors )
102
+		$classes = !empty($this->errors)
103 103
 			? glsr( StyleValidationDefaults::class )->defaults()['message_error_class']
104 104
 			: '';
105 105
 		return glsr( Template::class )->build( 'templates/form/response', [
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 				'class' => $classes,
108 108
 				'message' => wpautop( $this->message ),
109 109
 			],
110
-			'has_errors' => !empty( $this->errors ),
111
-		]);
110
+			'has_errors' => !empty($this->errors),
111
+		] );
112 112
 	}
113 113
 
114 114
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 			'context' => [
121 121
 				'text' => __( 'Submit your review', 'site-reviews' ),
122 122
 			],
123
-		]);
123
+		] );
124 124
 	}
125 125
 
126 126
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		$fields = array_merge(
140 140
 			$this->getHiddenFields(),
141 141
 			[$this->getHoneypotField()],
142
-			$this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ))
142
+			$this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ) )
143 143
 		);
144 144
 		return $fields;
145 145
 	}
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	protected function getLoginText()
151 151
 	{
152
-		$loginLink = glsr( Builder::class )->a([
153
-			'href' => wp_login_url( strval( get_permalink() )),
152
+		$loginLink = glsr( Builder::class )->a( [
153
+			'href' => wp_login_url( strval( get_permalink() ) ),
154 154
 			'text' => __( 'logged in', 'site-reviews' ),
155
-		]);
155
+		] );
156 156
 		return sprintf( __( 'You must be %s to submit a review.', 'site-reviews' ), $loginLink );
157 157
 	}
158 158
 
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 	protected function getRegisterText()
163 163
 	{
164 164
 		if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' )return;
165
-		$registerLink = glsr( Builder::class )->a([
165
+		$registerLink = glsr( Builder::class )->a( [
166 166
 			'href' => wp_registration_url(),
167 167
 			'text' => __( 'register', 'site-reviews' ),
168
-		]);
168
+		] );
169 169
 		return sprintf( __( 'You may also %s for an account.', 'site-reviews' ), $registerLink );
170 170
 	}
171 171
 
@@ -177,27 +177,27 @@  discard block
 block discarded – undo
177 177
 		$fields = [[
178 178
 			'name' => 'action',
179 179
 			'value' => 'submit-review',
180
-		],[
180
+		], [
181 181
 			'name' => 'assign_to',
182 182
 			'value' => $this->args['assign_to'],
183
-		],[
183
+		], [
184 184
 			'name' => 'category',
185 185
 			'value' => $this->args['category'],
186
-		],[
186
+		], [
187 187
 			'name' => 'excluded',
188 188
 			'value' => $this->args['excluded'], // @todo should default to "[]"
189
-		],[
189
+		], [
190 190
 			'name' => 'form_id',
191 191
 			'value' => $this->args['id'],
192
-		],[
192
+		], [
193 193
 			'name' => 'nonce',
194 194
 			'value' => wp_create_nonce( 'submit-review' ),
195
-		],[
195
+		], [
196 196
 			'name' => 'referer',
197
-			'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' )),
197
+			'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' ) ),
198 198
 		]];
199 199
 		return array_map( function( $field ) {
200
-			return new Field( wp_parse_args( $field, ['type' => 'hidden'] ));
200
+			return new Field( wp_parse_args( $field, ['type' => 'hidden'] ) );
201 201
 		}, $fields );
202 202
 	}
203 203
 
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	protected function getHoneypotField()
208 208
 	{
209
-		return new Field([
209
+		return new Field( [
210 210
 			'name' => 'gotcha',
211 211
 			'type' => 'honeypot',
212
-		]);
212
+		] );
213 213
 	}
214 214
 
215 215
 	/**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	protected function normalizeFieldErrors( Field &$field )
219 219
 	{
220
-		if( !array_key_exists( $field->field['path'], $this->errors ))return;
220
+		if( !array_key_exists( $field->field['path'], $this->errors ) )return;
221 221
 		$field->field['errors'] = $this->errors[$field->field['path']];
222 222
 	}
223 223
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	protected function normalizeFieldRequired( Field &$field )
228 228
 	{
229
-		if( !in_array( $field->field['path'], $this->required ))return;
229
+		if( !in_array( $field->field['path'], $this->required ) )return;
230 230
 		$field->field['required'] = true;
231 231
 	}
232 232
 
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	protected function normalizeFieldValue( Field &$field )
251 251
 	{
252
-		if( !array_key_exists( $field->field['path'], $this->values ))return;
253
-		if( in_array( $field->field['type'], ['radio', 'checkbox'] )) {
252
+		if( !array_key_exists( $field->field['path'], $this->values ) )return;
253
+		if( in_array( $field->field['type'], ['radio', 'checkbox'] ) ) {
254 254
 			$field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']];
255 255
 		}
256 256
 		else {
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 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' ),
@@ -161,7 +163,9 @@  discard block
 block discarded – undo
161 163
 	 */
162 164
 	protected function getRegisterText()
163 165
 	{
164
-		if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' )return;
166
+		if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' ) {
167
+			return;
168
+		}
165 169
 		$registerLink = glsr( Builder::class )->a([
166 170
 			'href' => wp_registration_url(),
167 171
 			'text' => __( 'register', 'site-reviews' ),
@@ -217,7 +221,9 @@  discard block
 block discarded – undo
217 221
 	 */
218 222
 	protected function normalizeFieldErrors( Field &$field )
219 223
 	{
220
-		if( !array_key_exists( $field->field['path'], $this->errors ))return;
224
+		if( !array_key_exists( $field->field['path'], $this->errors )) {
225
+			return;
226
+		}
221 227
 		$field->field['errors'] = $this->errors[$field->field['path']];
222 228
 	}
223 229
 
@@ -226,7 +232,9 @@  discard block
 block discarded – undo
226 232
 	 */
227 233
 	protected function normalizeFieldRequired( Field &$field )
228 234
 	{
229
-		if( !in_array( $field->field['path'], $this->required ))return;
235
+		if( !in_array( $field->field['path'], $this->required )) {
236
+			return;
237
+		}
230 238
 		$field->field['required'] = true;
231 239
 	}
232 240
 
@@ -249,7 +257,9 @@  discard block
 block discarded – undo
249 257
 	 */
250 258
 	protected function normalizeFieldValue( Field &$field )
251 259
 	{
252
-		if( !array_key_exists( $field->field['path'], $this->values ))return;
260
+		if( !array_key_exists( $field->field['path'], $this->values )) {
261
+			return;
262
+		}
253 263
 		if( in_array( $field->field['type'], ['radio', 'checkbox'] )) {
254 264
 			$field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']];
255 265
 		}
Please login to merge, or discard this patch.
deprecated.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,61 +3,61 @@
 block discarded – undo
3 3
 defined( 'WPINC' ) || die;
4 4
 
5 5
 add_action( 'site-reviews/local/review/submitted', function() {
6
-	if( has_filter( 'site-reviews/local/review/submitted/message' )) {
6
+	if( has_filter( 'site-reviews/local/review/submitted/message' ) ) {
7 7
 		glsr_log()->notice( 'The "site-reviews/local/review/submitted/message" hook has been deprecated.' );
8 8
 	}
9 9
 });
10 10
 
11 11
 add_filter( 'site-reviews/create/review-values', function( $values ) {
12
-	if( has_filter( 'site-reviews/local/review' )) {
12
+	if( has_filter( 'site-reviews/local/review' ) ) {
13 13
 		glsr_log()->notice( 'The "site-reviews/local/review" hook has been deprecated. Please use the "site-reviews/create/review-values" hook instead.' );
14 14
 	}
15 15
 	return $values;
16 16
 });
17 17
 
18 18
 add_filter( 'site-reviews/get/defaults', function( $defaults ) {
19
-	if( has_filter( 'site-reviews/addon/defaults' )) {
19
+	if( has_filter( 'site-reviews/addon/defaults' ) ) {
20 20
 		glsr_log()->notice( 'The "site-reviews/addon/defaults" hook has been deprecated. Please use the "site-reviews/get/defaults" hook instead.' );
21 21
 	}
22 22
 	return $defaults;
23 23
 });
24 24
 
25 25
 add_filter( 'site-reviews/rating/average', function( $average ) {
26
-	if( has_filter( 'site-reviews/average/rating' )) {
26
+	if( has_filter( 'site-reviews/average/rating' ) ) {
27 27
 		glsr_log()->notice( 'The "site-reviews/average/rating" hook has been deprecated. Please use the "site-reviews/rating/average" hook instead.' );
28 28
 	}
29 29
 	return $average;
30 30
 });
31 31
 
32 32
 add_filter( 'site-reviews/rating/ranking', function( $ranking ) {
33
-	if( has_filter( 'site-reviews/bayesian/ranking' )) {
33
+	if( has_filter( 'site-reviews/bayesian/ranking' ) ) {
34 34
 		glsr_log()->notice( 'The "site-reviews/bayesian/ranking" hook has been deprecated. Please use the "site-reviews/rating/ranking" hook instead.' );
35 35
 	}
36 36
 	return $ranking;
37 37
 });
38 38
 
39 39
 add_filter( 'site-reviews/review/build/before', function( $review ) {
40
-	if( has_filter( 'site-reviews/rendered/review/meta/order' )) {
40
+	if( has_filter( 'site-reviews/rendered/review/meta/order' ) ) {
41 41
 		glsr_log()->notice( 'The "site-reviews/rendered/review/meta/order" hook has been deprecated. Please use a custom template instead (refer to the documentation).' );
42 42
 	}
43
-	if( has_filter( 'site-reviews/rendered/review/order' )) {
43
+	if( has_filter( 'site-reviews/rendered/review/order' ) ) {
44 44
 		glsr_log()->notice( 'The "site-reviews/rendered/review/order" hook has been deprecated. Please use a custom template instead (refer to the documentation).' );
45 45
 	}
46 46
 	return $review;
47 47
 });
48 48
 
49 49
 add_filter( 'site-reviews/review/build/after', function( $review ) {
50
-	if( has_filter( 'site-reviews/reviews/review/text' )) {
50
+	if( has_filter( 'site-reviews/reviews/review/text' ) ) {
51 51
 		glsr_log()->notice( 'The "site-reviews/reviews/review/text" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.' );
52 52
 	}
53
-	if( has_filter( 'site-reviews/reviews/review/title' )) {
53
+	if( has_filter( 'site-reviews/reviews/review/title' ) ) {
54 54
 		glsr_log()->notice( 'The "site-reviews/reviews/review/title" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.' );
55 55
 	}
56 56
 	return $review;
57 57
 });
58 58
 
59 59
 add_filter( 'site-reviews/enqueue/public/localize', function( $variables ) {
60
-	if( has_filter( 'site-reviews/enqueue/localize' )) {
60
+	if( has_filter( 'site-reviews/enqueue/localize' ) ) {
61 61
 		glsr_log()->notice( 'The "site-reviews/enqueue/localize" hook has been deprecated. Please use the "site-reviews/enqueue/public/localize" hook instead.' );
62 62
 	}
63 63
 	return $variables;
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviews.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				'navigation' => $navigation,
58 58
 			],
59 59
 			'reviews' => $this->buildReviews(),
60
-		]);
60
+		] );
61 61
 	}
62 62
 
63 63
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$reviewValues = [];
84 84
 		foreach( $review as $key => $value ) {
85 85
 			$method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' );
86
-			if( !method_exists( $this, $method ))continue;
86
+			if( !method_exists( $this, $method ) )continue;
87 87
 			$reviewValues[$key] = $this->$method( $key, $value );
88 88
 		}
89 89
 		$reviewValues = apply_filters( 'site-reviews/review/build/after', (array)$reviewValues );
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	protected function buildOptionAssignedTo( $key, $value )
99 99
 	{
100
-		if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ))return;
101
-		$post = get_post( intval( $value ));
102
-		if( !( $post instanceof WP_Post ))return;
100
+		if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ) )return;
101
+		$post = get_post( intval( $value ) );
102
+		if( !($post instanceof WP_Post) )return;
103 103
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
104 104
 			'href' => get_the_permalink( $post->ID ),
105
-		]);
105
+		] );
106 106
 		$assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink );
107 107
 		return $this->wrap( $key, '<span>'.$assignedTo.'</span>' );
108 108
 	}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	protected function buildOptionAuthor( $key, $value )
116 116
 	{
117
-		if( $this->isHidden( $key ))return;
117
+		if( $this->isHidden( $key ) )return;
118 118
 		$prefix = !$this->isOptionEnabled( 'settings.reviews.avatars.enabled' )
119 119
 			? apply_filters( 'site-reviews/review/author/prefix', '&mdash;' )
120 120
 			: '';
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	protected function buildOptionAvatar( $key, $value )
130 130
 	{
131
-		if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ))return;
131
+		if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ) )return;
132 132
 		$size = $this->getOption( 'settings.reviews.avatars.size', 40 );
133
-		return $this->wrap( $key, glsr( Builder::class )->img([
133
+		return $this->wrap( $key, glsr( Builder::class )->img( [
134 134
 			'src' => $this->generateAvatar( $value ),
135 135
 			'height' => $size,
136 136
 			'width' => $size,
137
-		]));
137
+		] ) );
138 138
 	}
139 139
 
140 140
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	protected function buildOptionContent( $key, $value )
146 146
 	{
147 147
 		$text = $this->normalizeText( $value );
148
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
148
+		if( $this->isHiddenOrEmpty( $key, $text ) )return;
149 149
 		return $this->wrap( $key, '<p>'.$text.'</p>' );
150 150
 	}
151 151
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	protected function buildOptionDate( $key, $value )
158 158
 	{
159
-		if( $this->isHidden( $key ))return;
159
+		if( $this->isHidden( $key ) )return;
160 160
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
161 161
 		if( $dateFormat == 'relative' ) {
162 162
 			$date = glsr( Date::class )->relative( $value );
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			$format = $dateFormat == 'custom'
166 166
 				? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' )
167 167
 				: (string)get_option( 'date_format' );
168
-			$date = date_i18n( $format, strtotime( $value ));
168
+			$date = date_i18n( $format, strtotime( $value ) );
169 169
 		}
170 170
 		return $this->wrap( $key, '<span>'.$date.'</span>' );
171 171
 	}
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	protected function buildOptionRating( $key, $value )
179 179
 	{
180
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
180
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
181 181
 		$rating = glsr( Html::class )->buildPartial( 'star-rating', [
182 182
 			'rating' => $value,
183
-		]);
183
+		] );
184 184
 		return $this->wrap( $key, $rating );
185 185
 	}
186 186
 
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	protected function buildOptionResponse( $key, $value )
193 193
 	{
194
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
195
-		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
194
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
195
+		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) );
196 196
 		$text = $this->normalizeText( $value );
197 197
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
198 198
 		return $this->wrap( $key,
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	protected function buildOptionTitle( $key, $value )
210 210
 	{
211
-		if( $this->isHidden( $key ))return;
212
-		if( empty( $value )) {
211
+		if( $this->isHidden( $key ) )return;
212
+		if( empty($value) ) {
213 213
 			$value = __( 'No Title', 'site-reviews' );
214 214
 		}
215 215
 		return $this->wrap( $key, '<h3>'.$value.'</h3>' );
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			return $avatarUrl;
228 228
 		}
229 229
 		$authorIdOrEmail = get_the_author_meta( 'ID', $review->user_id );
230
-		if( empty( $authorIdOrEmail )) {
230
+		if( empty($authorIdOrEmail) ) {
231 231
 			$authorIdOrEmail = $review->email;
232 232
 		}
233 233
 		return (string)get_avatar_url( $authorIdOrEmail );
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	protected function generateSchema()
240 240
 	{
241
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
241
+		if( !wp_validate_boolean( $this->args['schema'] ) )return;
242 242
 		glsr( Schema::class )->store(
243 243
 			glsr( Schema::class )->build( $this->args )
244 244
 		);
@@ -261,18 +261,18 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	protected function getExcerpt( $text )
263 263
 	{
264
-		$limit = intval( $this->getOption( 'settings.reviews.excerpt.length', 55 ));
264
+		$limit = intval( $this->getOption( 'settings.reviews.excerpt.length', 55 ) );
265 265
 		$split = extension_loaded( 'intl' )
266 266
 			? $this->getExcerptIntlSplit( $text, $limit )
267 267
 			: $this->getExcerptSplit( $text, $limit );
268 268
 		$hiddenText = substr( $text, $split );
269
-		if( !empty( $hiddenText )) {
269
+		if( !empty($hiddenText) ) {
270 270
 			$showMore = glsr( Builder::class )->span( $hiddenText, [
271 271
 				'class' => 'glsr-hidden glsr-hidden-text',
272 272
 				'data-show-less' => __( 'Show less', 'site-reviews' ),
273 273
 				'data-show-more' => __( 'Show more', 'site-reviews' ),
274
-			]);
275
-			$text = ltrim( substr( $text, 0, $split )).$showMore;
274
+			] );
275
+			$text = ltrim( substr( $text, 0, $split ) ).$showMore;
276 276
 		}
277 277
 		return nl2br( $text );
278 278
 	}
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		$words = IntlRuleBasedBreakIterator::createWordInstance( '' );
288 288
 		$words->setText( $text );
289 289
 		$count = 0;
290
-		foreach( $words as $offset ){
290
+		foreach( $words as $offset ) {
291 291
 			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
292 292
 			$count++;
293 293
 			if( $count != $limit )continue;
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	protected function getExcerptSplit( $text, $limit )
305 305
 	{
306 306
 		if( str_word_count( $text, 0 ) > $limit ) {
307
-			$words = array_keys( str_word_count( $text, 2 ));
307
+			$words = array_keys( str_word_count( $text, 2 ) );
308 308
 			return $words[$limit];
309 309
 		}
310 310
 		return strlen( $text );
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	protected function getOption( $path, $fallback = '' )
319 319
 	{
320
-		if( array_key_exists( $path, $this->options )) {
320
+		if( array_key_exists( $path, $this->options ) ) {
321 321
 			return $this->options[$path];
322 322
 		}
323 323
 		return $fallback;
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 */
331 331
 	protected function isHidden( $key, $path = '' )
332 332
 	{
333
-		$isOptionEnabled = !empty( $path )
333
+		$isOptionEnabled = !empty($path)
334 334
 			? $this->isOptionEnabled( $path )
335 335
 			: true;
336 336
 		return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	 */
344 344
 	protected function isHiddenOrEmpty( $key, $value )
345 345
 	{
346
-		return $this->isHidden( $key ) || empty( $value );
346
+		return $this->isHidden( $key ) || empty($value);
347 347
 	}
348 348
 
349 349
 	/**
@@ -362,10 +362,10 @@  discard block
 block discarded – undo
362 362
 	protected function normalizeText( $text )
363 363
 	{
364 364
 		$text = wp_kses( $text, wp_kses_allowed_html() );
365
-		$text = convert_smilies( strip_shortcodes( $text ));
365
+		$text = convert_smilies( strip_shortcodes( $text ) );
366 366
 		$text = str_replace( ']]>', ']]&gt;', $text );
367 367
 		$text = preg_replace( '/(\R){2,}/', '$1', $text );
368
-		if( $this->isOptionEnabled( 'settings.reviews.excerpt.enabled' )) {
368
+		if( $this->isOptionEnabled( 'settings.reviews.excerpt.enabled' ) ) {
369 369
 			$text = $this->getExcerpt( $text );
370 370
 		}
371 371
 		return wptexturize( $text );
@@ -380,6 +380,6 @@  discard block
 block discarded – undo
380 380
 	{
381 381
 		return glsr( Builder::class )->div( $value, [
382 382
 			'class' => 'glsr-review-'.$key,
383
-		]);
383
+		] );
384 384
 	}
385 385
 }
Please login to merge, or discard this patch.
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -83,7 +83,9 @@  discard block
 block discarded – undo
83 83
 		$reviewValues = [];
84 84
 		foreach( $review as $key => $value ) {
85 85
 			$method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' );
86
-			if( !method_exists( $this, $method ))continue;
86
+			if( !method_exists( $this, $method )) {
87
+				continue;
88
+			}
87 89
 			$reviewValues[$key] = $this->$method( $key, $value );
88 90
 		}
89 91
 		$reviewValues = apply_filters( 'site-reviews/review/build/after', (array)$reviewValues );
@@ -97,9 +99,13 @@  discard block
 block discarded – undo
97 99
 	 */
98 100
 	protected function buildOptionAssignedTo( $key, $value )
99 101
 	{
100
-		if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ))return;
102
+		if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' )) {
103
+			return;
104
+		}
101 105
 		$post = get_post( intval( $value ));
102
-		if( !( $post instanceof WP_Post ))return;
106
+		if( !( $post instanceof WP_Post )) {
107
+			return;
108
+		}
103 109
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
104 110
 			'href' => get_the_permalink( $post->ID ),
105 111
 		]);
@@ -114,7 +120,9 @@  discard block
 block discarded – undo
114 120
 	 */
115 121
 	protected function buildOptionAuthor( $key, $value )
116 122
 	{
117
-		if( $this->isHidden( $key ))return;
123
+		if( $this->isHidden( $key )) {
124
+			return;
125
+		}
118 126
 		$prefix = !$this->isOptionEnabled( 'settings.reviews.avatars.enabled' )
119 127
 			? apply_filters( 'site-reviews/review/author/prefix', '&mdash;' )
120 128
 			: '';
@@ -128,7 +136,9 @@  discard block
 block discarded – undo
128 136
 	 */
129 137
 	protected function buildOptionAvatar( $key, $value )
130 138
 	{
131
-		if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ))return;
139
+		if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' )) {
140
+			return;
141
+		}
132 142
 		$size = $this->getOption( 'settings.reviews.avatars.size', 40 );
133 143
 		return $this->wrap( $key, glsr( Builder::class )->img([
134 144
 			'src' => $this->generateAvatar( $value ),
@@ -145,7 +155,9 @@  discard block
 block discarded – undo
145 155
 	protected function buildOptionContent( $key, $value )
146 156
 	{
147 157
 		$text = $this->normalizeText( $value );
148
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
158
+		if( $this->isHiddenOrEmpty( $key, $text )) {
159
+			return;
160
+		}
149 161
 		return $this->wrap( $key, '<p>'.$text.'</p>' );
150 162
 	}
151 163
 
@@ -156,7 +168,9 @@  discard block
 block discarded – undo
156 168
 	 */
157 169
 	protected function buildOptionDate( $key, $value )
158 170
 	{
159
-		if( $this->isHidden( $key ))return;
171
+		if( $this->isHidden( $key )) {
172
+			return;
173
+		}
160 174
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
161 175
 		if( $dateFormat == 'relative' ) {
162 176
 			$date = glsr( Date::class )->relative( $value );
@@ -177,7 +191,9 @@  discard block
 block discarded – undo
177 191
 	 */
178 192
 	protected function buildOptionRating( $key, $value )
179 193
 	{
180
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
194
+		if( $this->isHiddenOrEmpty( $key, $value )) {
195
+			return;
196
+		}
181 197
 		$rating = glsr( Html::class )->buildPartial( 'star-rating', [
182 198
 			'rating' => $value,
183 199
 		]);
@@ -191,7 +207,9 @@  discard block
 block discarded – undo
191 207
 	 */
192 208
 	protected function buildOptionResponse( $key, $value )
193 209
 	{
194
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
210
+		if( $this->isHiddenOrEmpty( $key, $value )) {
211
+			return;
212
+		}
195 213
 		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
196 214
 		$text = $this->normalizeText( $value );
197 215
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
@@ -208,7 +226,9 @@  discard block
 block discarded – undo
208 226
 	 */
209 227
 	protected function buildOptionTitle( $key, $value )
210 228
 	{
211
-		if( $this->isHidden( $key ))return;
229
+		if( $this->isHidden( $key )) {
230
+			return;
231
+		}
212 232
 		if( empty( $value )) {
213 233
 			$value = __( 'No Title', 'site-reviews' );
214 234
 		}
@@ -238,7 +258,9 @@  discard block
 block discarded – undo
238 258
 	 */
239 259
 	protected function generateSchema()
240 260
 	{
241
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
261
+		if( !wp_validate_boolean( $this->args['schema'] )) {
262
+			return;
263
+		}
242 264
 		glsr( Schema::class )->store(
243 265
 			glsr( Schema::class )->build( $this->args )
244 266
 		);
@@ -288,9 +310,13 @@  discard block
 block discarded – undo
288 310
 		$words->setText( $text );
289 311
 		$count = 0;
290 312
 		foreach( $words as $offset ){
291
-			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
313
+			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE ) {
314
+				continue;
315
+			}
292 316
 			$count++;
293
-			if( $count != $limit )continue;
317
+			if( $count != $limit ) {
318
+				continue;
319
+			}
294 320
 			return $offset;
295 321
 		}
296 322
 		return strlen( $text );
Please login to merge, or discard this patch.