Passed
Push — master ( 25783a...cd4854 )
by Paul
05:21
created
plugin/Router.php 2 patches
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 	public function routeAdminPostRequest()
17 17
 	{
18 18
 		$request = $this->getRequest();
19
-		if( !$this->isValidPostRequest( $request ))return;
19
+		if( !$this->isValidPostRequest( $request )) {
20
+			return;
21
+		}
20 22
 		check_admin_referer( $request['action'] );
21 23
 		$this->routeRequest( 'admin', $request['action'], $request );
22 24
 	}
@@ -38,10 +40,16 @@  discard block
 block discarded – undo
38 40
 	 */
39 41
 	public function routePublicPostRequest()
40 42
 	{
41
-		if( is_admin() )return;
43
+		if( is_admin() ) {
44
+			return;
45
+		}
42 46
 		$request = $this->getRequest();
43
-		if( !$this->isValidPostRequest( $request ))return;
44
-		if( !$this->isValidPublicNonce( $request ))return;
47
+		if( !$this->isValidPostRequest( $request )) {
48
+			return;
49
+		}
50
+		if( !$this->isValidPublicNonce( $request )) {
51
+			return;
52
+		}
45 53
 		$this->routeRequest( 'public', $request['action'], $request );
46 54
 	}
47 55
 
@@ -50,7 +58,9 @@  discard block
 block discarded – undo
50 58
 	 */
51 59
 	protected function checkAjaxNonce( array $request )
52 60
 	{
53
-		if( !is_user_logged_in() )return;
61
+		if( !is_user_logged_in() ) {
62
+			return;
63
+		}
54 64
 		if( !isset( $request['nonce'] )) {
55 65
 			$this->sendAjaxError( 'The request is missing a nonce', $request );
56 66
 		}
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	public function routeAdminPostRequest()
17 17
 	{
18 18
 		$request = $this->getRequest();
19
-		if( !$this->isValidPostRequest( $request ))return;
19
+		if( !$this->isValidPostRequest( $request ) )return;
20 20
 		check_admin_referer( $request['action'] );
21 21
 		$this->routeRequest( 'admin', $request['action'], $request );
22 22
 	}
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		if( is_admin() )return;
42 42
 		$request = $this->getRequest();
43
-		if( !$this->isValidPostRequest( $request ))return;
44
-		if( !$this->isValidPublicNonce( $request ))return;
43
+		if( !$this->isValidPostRequest( $request ) )return;
44
+		if( !$this->isValidPublicNonce( $request ) )return;
45 45
 		$this->routeRequest( 'public', $request['action'], $request );
46 46
 	}
47 47
 
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	protected function checkAjaxNonce( array $request )
52 52
 	{
53 53
 		if( !is_user_logged_in() )return;
54
-		if( !isset( $request['nonce'] )) {
54
+		if( !isset($request['nonce']) ) {
55 55
 			$this->sendAjaxError( 'The request is missing a nonce', $request );
56 56
 		}
57
-		if( !wp_verify_nonce( $request['nonce'], $request['action'] )) {
57
+		if( !wp_verify_nonce( $request['nonce'], $request['action'] ) ) {
58 58
 			$this->sendAjaxError( 'The request failed the nonce check', $request, 403 );
59 59
 		}
60 60
 	}
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	protected function checkAjaxRequest( array $request )
66 66
 	{
67
-		if( !isset( $request['action'] )) {
67
+		if( !isset($request['action']) ) {
68 68
 			$this->sendAjaxError( 'The request must include an action', $request );
69 69
 		}
70
-		if( empty( $request['ajax_request'] )) {
70
+		if( empty($request['ajax_request']) ) {
71 71
 			$this->sendAjaxError( 'The request is invalid', $request );
72 72
 		}
73 73
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 			return glsr( Helper::class )->filterInputArray( Application::ID );
85 85
 		}
86 86
 		$request = glsr( Helper::class )->filterInputArray( 'request' );
87
-		if( empty( $request )) {
87
+		if( empty($request) ) {
88 88
 			$request = glsr( Helper::class )->filterInputArray( Application::ID );
89 89
 		}
90 90
 		return $this->normalizeRequest( $request );
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	protected function isValidPostRequest( array $request = [] )
97 97
 	{
98
-		return !empty( $request['action'] ) && empty( $request['ajax_request'] );
98
+		return !empty($request['action']) && empty($request['ajax_request']);
99 99
 	}
100 100
 
101 101
 	/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function isValidPublicNonce( array $request )
105 105
 	{
106
-		if( is_user_logged_in() && !wp_verify_nonce( $request['nonce'], $request['action'] )) {
106
+		if( is_user_logged_in() && !wp_verify_nonce( $request['nonce'], $request['action'] ) ) {
107 107
 			glsr_log()->error( 'Nonce check failed for public request' )->info( $request );
108 108
 			return false;
109 109
 		}
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	protected function routeRequest( $type, $action, array $request = [] )
133 133
 	{
134 134
 		$actionHook = 'site-reviews/route/'.$type.'/request';
135
-		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ));
135
+		$controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ) );
136 136
 		$method = glsr( Helper::class )->buildMethodName( $action, 'router' );
137 137
 		$request = apply_filters( 'site-reviews/route/request', $request, $action, $type );
138 138
 		do_action( $actionHook, $action, $request );
139
-		if( is_callable( [$controller, $method] )) {
139
+		if( is_callable( [$controller, $method] ) ) {
140 140
 			call_user_func( [$controller, $method], $request );
141 141
 			return;
142 142
 		}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	protected function sendAjaxError( $error, array $request, $statusCode = 400 )
154 154
 	{
155 155
 		glsr_log()->error( $error )->info( $request );
156
-		wp_send_json_error([
156
+		wp_send_json_error( [
157 157
 			'message' => __( 'The form could not be submitted. Please notify the site administrator.', 'site-reviews' ),
158 158
 			'error' => $error,
159 159
 		], $statusCode );
Please login to merge, or discard this patch.
compatibility.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,5 +9,5 @@
 block discarded – undo
9 9
  */
10 10
 add_filter( 'sbp_exclude_defer_scripts', function( $scriptHandles ) {
11 11
 	$scriptHandles[] = 'site-reviews/google-recaptcha';
12
-	return array_keys( array_flip( $scriptHandles ));
12
+	return array_keys( array_flip( $scriptHandles ) );
13 13
 });
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviews.php 2 patches
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', $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', '—' )
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
 		);
@@ -289,9 +311,13 @@  discard block
 block discarded – undo
289 311
 		$words->setText( $text );
290 312
 		$count = 0;
291 313
 		foreach( $words as $offset ){
292
-			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
314
+			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE ) {
315
+				continue;
316
+			}
293 317
 			$count++;
294
-			if( $count != $limit )continue;
318
+			if( $count != $limit ) {
319
+				continue;
320
+			}
295 321
 			return $offset;
296 322
 		}
297 323
 		return strlen( $text );
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 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', $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
 		);
@@ -262,18 +262,18 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	protected function getExcerpt( $text )
264 264
 	{
265
-		$limit = intval( $this->getOption( 'settings.reviews.excerpt.length', 55 ));
265
+		$limit = intval( $this->getOption( 'settings.reviews.excerpt.length', 55 ) );
266 266
 		$split = extension_loaded( 'intl' )
267 267
 			? $this->getExcerptIntlSplit( $text, $limit )
268 268
 			: $this->getExcerptSplit( $text, $limit );
269 269
 		$hiddenText = substr( $text, $split );
270
-		if( !empty( $hiddenText )) {
270
+		if( !empty($hiddenText) ) {
271 271
 			$showMore = glsr( Builder::class )->span( $hiddenText, [
272 272
 				'class' => 'glsr-hidden glsr-hidden-text',
273 273
 				'data-show-less' => __( 'Show less', 'site-reviews' ),
274 274
 				'data-show-more' => __( 'Show more', 'site-reviews' ),
275
-			]);
276
-			$text = ltrim( substr( $text, 0, $split )).$showMore;
275
+			] );
276
+			$text = ltrim( substr( $text, 0, $split ) ).$showMore;
277 277
 		}
278 278
 		return nl2br( $text );
279 279
 	}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		$words = IntlRuleBasedBreakIterator::createWordInstance( '' );
289 289
 		$words->setText( $text );
290 290
 		$count = 0;
291
-		foreach( $words as $offset ){
291
+		foreach( $words as $offset ) {
292 292
 			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
293 293
 			$count++;
294 294
 			if( $count != $limit )continue;
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	protected function getExcerptSplit( $text, $limit )
306 306
 	{
307 307
 		if( str_word_count( $text, 0 ) > $limit ) {
308
-			$words = array_keys( str_word_count( $text, 2 ));
308
+			$words = array_keys( str_word_count( $text, 2 ) );
309 309
 			return $words[$limit];
310 310
 		}
311 311
 		return strlen( $text );
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	protected function getOption( $path, $fallback = '' )
320 320
 	{
321
-		if( array_key_exists( $path, $this->options )) {
321
+		if( array_key_exists( $path, $this->options ) ) {
322 322
 			return $this->options[$path];
323 323
 		}
324 324
 		return $fallback;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 */
332 332
 	protected function isHidden( $key, $path = '' )
333 333
 	{
334
-		$isOptionEnabled = !empty( $path )
334
+		$isOptionEnabled = !empty($path)
335 335
 			? $this->isOptionEnabled( $path )
336 336
 			: true;
337 337
 		return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 */
345 345
 	protected function isHiddenOrEmpty( $key, $value )
346 346
 	{
347
-		return $this->isHidden( $key ) || empty( $value );
347
+		return $this->isHidden( $key ) || empty($value);
348 348
 	}
349 349
 
350 350
 	/**
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	protected function normalizeText( $text )
364 364
 	{
365 365
 		$text = wp_kses( $text, wp_kses_allowed_html() );
366
-		$text = convert_smilies( wptexturize( strip_shortcodes( $text )));
366
+		$text = convert_smilies( wptexturize( strip_shortcodes( $text ) ) );
367 367
 		$text = str_replace( ']]>', ']]&gt;', $text );
368 368
 		$text = preg_replace( '/(\R){2,}/', '$1', $text );
369 369
 		return $this->isOptionEnabled( 'settings.reviews.excerpt.enabled' )
@@ -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.
plugin/Database/ReviewManager.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 			'post_type' => Application::POST_TYPE,
34 34
 		];
35 35
 		$postId = wp_insert_post( $post, true );
36
-		if( is_wp_error( $postId )) {
36
+		if( is_wp_error( $postId ) ) {
37 37
 			glsr_log()->error( $postId->get_error_message() );
38 38
 			return 0;
39 39
 		}
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function delete( $metaReviewId )
50 50
 	{
51
-		if( $postId = $this->getPostId( $metaReviewId )) {
51
+		if( $postId = $this->getPostId( $metaReviewId ) ) {
52 52
 			wp_delete_post( $postId, true );
53 53
 		}
54 54
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		$paged = glsr( QueryBuilder::class )->getPaged(
71 71
 			wp_validate_boolean( $args['pagination'] )
72 72
 		);
73
-		$reviews = new WP_Query([
73
+		$reviews = new WP_Query( [
74 74
 			'meta_key' => 'pinned',
75 75
 			'meta_query' => $metaQuery,
76 76
 			'offset' => $args['offset'],
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			'post_type' => Application::POST_TYPE,
84 84
 			'posts_per_page' => $args['count'],
85 85
 			'tax_query' => $taxQuery,
86
-		]);
86
+		] );
87 87
 		return (object)[
88 88
 			'results' => array_map( [$this, 'single'], $reviews->posts ),
89 89
 			'max_num_pages' => $reviews->max_num_pages,
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 	{
108 108
 		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return;
109 109
 		delete_post_meta( $postId, '_edit_last' );
110
-		$result = wp_update_post([
110
+		$result = wp_update_post( [
111 111
 			'ID' => $postId,
112 112
 			'post_content' => get_post_meta( $postId, 'content', true ),
113 113
 			'post_date' => get_post_meta( $postId, 'date', true ),
114 114
 			'post_title' => get_post_meta( $postId, 'title', true ),
115
-		]);
116
-		if( is_wp_error( $result )) {
115
+		] );
116
+		if( is_wp_error( $result ) ) {
117 117
 			glsr_log()->error( $result->get_error_message() );
118 118
 		}
119 119
 	}
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	protected function getNewPostStatus( array $review, $isBlacklisted )
136 136
 	{
137 137
 		$requireApprovalOption = glsr( OptionManager::class )->get( 'settings.general.require.approval' );
138
-		return $review['review_type'] == 'local' && ( $requireApprovalOption == 'yes' || $isBlacklisted )
138
+		return $review['review_type'] == 'local' && ($requireApprovalOption == 'yes' || $isBlacklisted)
139 139
 			? 'pending'
140 140
 			: 'publish';
141 141
 	}
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 	protected function normalizeTerms( $commaSeparatedTermIds )
148 148
 	{
149 149
 		$terms = [];
150
-		$termIds = array_map( 'trim', explode( ',', $commaSeparatedTermIds ));
150
+		$termIds = array_map( 'trim', explode( ',', $commaSeparatedTermIds ) );
151 151
 		foreach( $termIds as $termId ) {
152 152
 			$term = term_exists( $termId, Application::TAXONOMY );
153
-			if( !isset( $term['term_id'] ))continue;
153
+			if( !isset($term['term_id']) )continue;
154 154
 			$terms[] = intval( $term['term_id'] );
155 155
 		}
156 156
 		return $terms;
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 	protected function setTerms( $postId, $termIds )
165 165
 	{
166 166
 		$terms = $this->normalizeTerms( $termIds );
167
-		if( empty( $terms ))return;
167
+		if( empty($terms) )return;
168 168
 		$result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY );
169
-		if( is_wp_error( $result )) {
169
+		if( is_wp_error( $result ) ) {
170 170
 			glsr_log()->error( $result->get_error_message() );
171 171
 		}
172 172
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -105,7 +105,9 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function revert( $postId )
107 107
 	{
108
-		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return;
108
+		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE ) {
109
+			return;
110
+		}
109 111
 		delete_post_meta( $postId, '_edit_last' );
110 112
 		$result = wp_update_post([
111 113
 			'ID' => $postId,
@@ -123,7 +125,9 @@  discard block
 block discarded – undo
123 125
 	 */
124 126
 	public function single( WP_Post $post )
125 127
 	{
126
-		if( $post->post_type != Application::POST_TYPE )return;
128
+		if( $post->post_type != Application::POST_TYPE ) {
129
+			return;
130
+		}
127 131
 		$review = new Review( $post );
128 132
 		return apply_filters( 'site-reviews/get/review', $review, $post );
129 133
 	}
@@ -150,7 +154,9 @@  discard block
 block discarded – undo
150 154
 		$termIds = array_map( 'trim', explode( ',', $commaSeparatedTermIds ));
151 155
 		foreach( $termIds as $termId ) {
152 156
 			$term = term_exists( $termId, Application::TAXONOMY );
153
-			if( !isset( $term['term_id'] ))continue;
157
+			if( !isset( $term['term_id'] )) {
158
+				continue;
159
+			}
154 160
 			$terms[] = intval( $term['term_id'] );
155 161
 		}
156 162
 		return $terms;
@@ -164,7 +170,9 @@  discard block
 block discarded – undo
164 170
 	protected function setTerms( $postId, $termIds )
165 171
 	{
166 172
 		$terms = $this->normalizeTerms( $termIds );
167
-		if( empty( $terms ))return;
173
+		if( empty( $terms )) {
174
+			return;
175
+		}
168 176
 		$result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY );
169 177
 		if( is_wp_error( $result )) {
170 178
 			glsr_log()->error( $result->get_error_message() );
Please login to merge, or discard this patch.
plugin/Modules/Schema.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 		foreach( glsr( ReviewManager::class )->get( $this->args )->results as $review ) {
35 35
 			// Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews.
36 36
 			// @see https://developers.google.com/search/docs/data-types/review
37
-			if( $review->review_type != 'local' )continue;
37
+			if( $review->review_type != 'local' ) {
38
+				continue;
39
+			}
38 40
 			$reviews[] = $this->buildReview( $review );
39 41
 		}
40 42
 		if( !empty( $reviews )) {
@@ -79,7 +81,9 @@  discard block
 block discarded – undo
79 81
 	 */
80 82
 	public function render()
81 83
 	{
82
-		if( is_null( glsr()->schemas ))return;
84
+		if( is_null( glsr()->schemas )) {
85
+			return;
86
+		}
83 87
 		printf( '<script type="application/ld+json">%s</script>', json_encode(
84 88
 			apply_filters( 'site-reviews/schema/all', glsr()->schemas ),
85 89
 			JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
@@ -131,7 +135,9 @@  discard block
 block discarded – undo
131 135
 	{
132 136
 		foreach( $values as $value ) {
133 137
 			$option = $this->getSchemaOptionValue( $value );
134
-			if( empty( $option ))continue;
138
+			if( empty( $option )) {
139
+				continue;
140
+			}
135 141
 			$schema->$value( $option );
136 142
 		}
137 143
 		return $schema;
@@ -237,7 +243,9 @@  discard block
 block discarded – undo
237 243
 		if( $value != $fallback ) {
238 244
 			return $value;
239 245
 		}
240
-		if( !is_single() && !is_page() )return;
246
+		if( !is_single() && !is_page() ) {
247
+			return;
248
+		}
241 249
 		$method = glsr( Helper::class )->buildMethodName( $option, 'getThing' );
242 250
 		if( method_exists( $this, $method )) {
243 251
 			return $this->$method();
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 			if( $review->review_type != 'local' )continue;
38 38
 			$reviews[] = $this->buildReview( $review );
39 39
 		}
40
-		if( !empty( $reviews )) {
40
+		if( !empty($reviews) ) {
41 41
 			array_walk( $reviews, function( &$review ) {
42
-				unset( $review['@context'] );
43
-				unset( $review['itemReviewed'] );
42
+				unset($review['@context']);
43
+				unset($review['itemReviewed']);
44 44
 			});
45 45
 			$schema['review'] = $reviews;
46 46
 		}
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function buildSummary( $args = null )
55 55
 	{
56
-		if( is_array( $args )) {
56
+		if( is_array( $args ) ) {
57 57
 			$this->args = $args;
58 58
 		}
59 59
 		$buildSummary = glsr( Helper::class )->buildMethodName( $this->getSchemaOptionValue( 'type' ), 'buildSummaryFor' );
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		$schema = method_exists( $this, $buildSummary )
62 62
 			? $this->$buildSummary()
63 63
 			: $this->buildSummaryForCustom();
64
-		if( !empty( $count )) {
64
+		if( !empty($count) ) {
65 65
 			$schema->aggregateRating(
66 66
 				$this->getSchemaType( 'AggregateRating' )
67 67
 					->ratingValue( $this->getRatingValue() )
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function render()
81 81
 	{
82
-		if( is_null( glsr()->schemas ))return;
82
+		if( is_null( glsr()->schemas ) )return;
83 83
 		printf( '<script type="application/ld+json">%s</script>', json_encode(
84 84
 			apply_filters( 'site-reviews/schema/all', glsr()->schemas ),
85 85
 			JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
86
-		));
86
+		) );
87 87
 	}
88 88
 
89 89
 	/**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	{
94 94
 		$schemas = glsr()->schemas;
95 95
 		$schemas[] = $schema;
96
-		glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas )));
96
+		glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas ) ) );
97 97
 	}
98 98
 
99 99
 	/**
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
 	protected function buildReview( $review )
104 104
 	{
105 105
 		$schema = $this->getSchemaType( 'Review' )
106
-			->doIf( !in_array( 'title', $this->args['hide'] ), function( $schema ) use( $review ) {
106
+			->doIf( !in_array( 'title', $this->args['hide'] ), function( $schema ) use($review) {
107 107
 				$schema->name( $review->title );
108 108
 			})
109
-			->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( $schema ) use( $review ) {
109
+			->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( $schema ) use($review) {
110 110
 				$schema->reviewBody( $review->content );
111 111
 			})
112
-			->datePublished(( new DateTime( $review->date )))
113
-			->author( $this->getSchemaType( 'Person' )->name( $review->author ))
114
-			->itemReviewed( $this->getSchemaType()->name( $this->getSchemaOptionValue( 'name' )));
115
-		if( !empty( $review->rating )) {
112
+			->datePublished( (new DateTime( $review->date )) )
113
+			->author( $this->getSchemaType( 'Person' )->name( $review->author ) )
114
+			->itemReviewed( $this->getSchemaType()->name( $this->getSchemaOptionValue( 'name' ) ) );
115
+		if( !empty($review->rating) ) {
116 116
 			$schema->reviewRating(
117 117
 				$this->getSchemaType( 'Rating' )
118 118
 					->ratingValue( $review->rating )
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	{
132 132
 		foreach( $values as $value ) {
133 133
 			$option = $this->getSchemaOptionValue( $value );
134
-			if( empty( $option ))continue;
134
+			if( empty($option) )continue;
135 135
 			$schema->$value( $option );
136 136
 		}
137 137
 		return $schema;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	{
145 145
 		return $this->buildSchemaValues( $this->getSchemaType(), [
146 146
 			'description', 'image', 'name', 'url',
147
-		]);
147
+		] );
148 148
 	}
149 149
 
150 150
 	/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	{
155 155
 		return $this->buildSchemaValues( $this->buildSummaryForCustom(), [
156 156
 			'address', 'priceRange', 'telephone',
157
-		]);
157
+		] );
158 158
 	}
159 159
 
160 160
 	/**
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 	{
165 165
 		$offers = $this->buildSchemaValues( $this->getSchemaType( 'AggregateOffer' ), [
166 166
 			'highPrice', 'lowPrice', 'priceCurrency',
167
-		]);
167
+		] );
168 168
 		return $this->buildSummaryForCustom()
169 169
 			->offers( $offers )
170
-			->setProperty( '@id', $this->getSchemaOptionValue( 'url' ));
170
+			->setProperty( '@id', $this->getSchemaOptionValue( 'url' ) );
171 171
 	}
172 172
 
173 173
 	/**
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	protected function getRatingCounts()
177 177
 	{
178
-		if( !isset( $this->ratingCounts )) {
179
-			$this->ratingCounts = glsr( CountsManager::class )->getFlattened([
178
+		if( !isset($this->ratingCounts) ) {
179
+			$this->ratingCounts = glsr( CountsManager::class )->getFlattened( [
180 180
 				'min' => $this->args['rating'],
181 181
 				'types' => 'local',
182
-			]);
182
+			] );
183 183
 		}
184 184
 		return $this->ratingCounts;
185 185
 	}
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 	protected function getSchemaOption( $option, $fallback )
201 201
 	{
202 202
 		$option = strtolower( $option );
203
-		if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ))) {
203
+		if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ) ) ) {
204 204
 			return $schemaOption;
205 205
 		}
206 206
 		$setting = glsr( OptionManager::class )->get( 'settings.schema.'.$option );
207
-		if( is_array( $setting )) {
207
+		if( is_array( $setting ) ) {
208 208
 			return $this->getSchemaOptionDefault( $setting, $fallback );
209 209
 		}
210
-		return !empty( $setting )
210
+		return !empty($setting)
211 211
 			? $setting
212 212
 			: $fallback;
213 213
 	}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		$setting = wp_parse_args( $setting, [
222 222
 			'custom' => '',
223 223
 			'default' => $fallback,
224
-		]);
224
+		] );
225 225
 		return $setting['default'] != 'custom'
226 226
 			? $setting['default']
227 227
 			: $setting['custom'];
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		}
241 241
 		if( !is_single() && !is_page() )return;
242 242
 		$method = glsr( Helper::class )->buildMethodName( $option, 'getThing' );
243
-		if( method_exists( $this, $method )) {
243
+		if( method_exists( $this, $method ) ) {
244 244
 			return $this->$method();
245 245
 		}
246 246
 	}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	protected function getSchemaType( $type = null )
253 253
 	{
254
-		if( !is_string( $type )) {
254
+		if( !is_string( $type ) ) {
255 255
 			$type = $this->getSchemaOption( 'type', 'LocalBusiness' );
256 256
 		}
257 257
 		$className = glsr( Helper::class )->buildClassName( $type, 'Modules\Schema' );
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	protected function getThingDescription()
267 267
 	{
268 268
 		$post = get_post();
269
-		if( !( $post instanceof WP_Post )) {
269
+		if( !($post instanceof WP_Post) ) {
270 270
 			return '';
271 271
 		}
272
-		$text = strip_shortcodes( wp_strip_all_tags( $post->post_excerpt ));
273
-		return wp_trim_words( $text, apply_filters( 'excerpt_length', 55 ));
272
+		$text = strip_shortcodes( wp_strip_all_tags( $post->post_excerpt ) );
273
+		return wp_trim_words( $text, apply_filters( 'excerpt_length', 55 ) );
274 274
 	}
275 275
 
276 276
 	/**
Please login to merge, or discard this patch.
plugin/Modules/Upgrader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 		natsort( $routines );
18 18
 		array_walk( $routines, function( $routine ) {
19 19
 			$parts = explode( '__', $routine );
20
-			if( version_compare( glsr()->version, end( $parts ), '>=' ))return;
20
+			if( version_compare( glsr()->version, end( $parts ), '>=' ) )return;
21 21
 			call_user_func( [$this, $routine] );
22 22
 		});
23 23
 		$this->updateVersion();
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function updateVersion()
30 30
 	{
31 31
 		$currentVersion = glsr( OptionManager::class )->get( 'version' );
32
-		if( version_compare( $currentVersion, glsr()->version, '<' )) {
32
+		if( version_compare( $currentVersion, glsr()->version, '<' ) ) {
33 33
 			glsr( OptionManager::class )->set( 'version', glsr()->version );
34 34
 		}
35 35
 		if( $currentVersion != glsr()->version ) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 		natsort( $routines );
18 18
 		array_walk( $routines, function( $routine ) {
19 19
 			$parts = explode( '__', $routine );
20
-			if( version_compare( glsr()->version, end( $parts ), '>=' ))return;
20
+			if( version_compare( glsr()->version, end( $parts ), '>=' )) {
21
+				return;
22
+			}
21 23
 			call_user_func( [$this, $routine] );
22 24
 		});
23 25
 		$this->updateVersion();
Please login to merge, or discard this patch.
plugin/Review.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,13 +59,13 @@
 block discarded – undo
59 59
 			'review_type' => '',
60 60
 		];
61 61
 		$meta = array_filter(
62
-			array_map( 'array_shift', (array)get_post_meta( $post->ID )),
62
+			array_map( 'array_shift', (array)get_post_meta( $post->ID ) ),
63 63
 			'strlen'
64 64
 		);
65
-		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
65
+		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) );
66 66
 		$this->modified = $this->isModified( $properties );
67 67
 		array_walk( $properties, function( $value, $key ) {
68
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
68
+			if( !property_exists( $this, $key ) || isset($this->$key) )return;
69 69
 			$this->$key = $value;
70 70
 		});
71 71
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,9 @@
 block discarded – undo
65 65
 		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
66 66
 		$this->modified = $this->isModified( $properties );
67 67
 		array_walk( $properties, function( $value, $key ) {
68
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
68
+			if( !property_exists( $this, $key ) || isset( $this->$key )) {
69
+				return;
70
+			}
69 71
 			$this->$key = $value;
70 72
 		});
71 73
 	}
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function renderAssignedToMetabox( WP_Post $post )
182 182
 	{
183
-		if( !$this->isReviewPostType( $post ))return;
183
+		if( !$this->isReviewPostType( $post ) )return;
184 184
 		$assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true );
185 185
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
186 186
 		glsr()->render( 'partials/editor/metabox-assigned-to', [
187 187
 			'id' => $assignedTo,
188 188
 			'template' => $this->buildAssignedToTemplate( $assignedTo, $post ),
189
-		]);
189
+		] );
190 190
 	}
191 191
 
192 192
 	/**
@@ -195,12 +195,12 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function renderDetailsMetaBox( WP_Post $post )
197 197
 	{
198
-		if( !$this->isReviewPostType( $post ))return;
198
+		if( !$this->isReviewPostType( $post ) )return;
199 199
 		$review = glsr( ReviewManager::class )->single( $post );
200 200
 		glsr()->render( 'partials/editor/metabox-details', [
201 201
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
202 202
 			'metabox' => $this->normalizeDetailsMetaBox( $review ),
203
-		]);
203
+		] );
204 204
 	}
205 205
 
206 206
 	/**
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public function renderPinnedInPublishMetaBox()
211 211
 	{
212
-		if( !$this->isReviewPostType( get_post() ))return;
212
+		if( !$this->isReviewPostType( get_post() ) )return;
213 213
 		glsr( Html::class )->renderTemplate( 'partials/editor/pinned', [
214 214
 			'context' => [
215 215
 				'no' => __( 'No', 'site-reviews' ),
216 216
 				'yes' => __( 'Yes', 'site-reviews' ),
217 217
 			],
218
-			'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true )),
219
-		]);
218
+			'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ),
219
+		] );
220 220
 	}
221 221
 
222 222
 	/**
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public function renderResponseMetaBox( WP_Post $post )
227 227
 	{
228
-		if( !$this->isReviewPostType( $post ))return;
228
+		if( !$this->isReviewPostType( $post ) )return;
229 229
 		wp_nonce_field( 'response', '_nonce-response', false );
230 230
 		glsr()->render( 'partials/editor/metabox-response', [
231 231
 			'response' => get_post_meta( $post->ID, 'response', true ),
232
-		]);
232
+		] );
233 233
 	}
234 234
 
235 235
 	/**
@@ -239,12 +239,12 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	public function renderTaxonomyMetabox( WP_Post $post )
241 241
 	{
242
-		if( !$this->isReviewPostType( $post ))return;
242
+		if( !$this->isReviewPostType( $post ) )return;
243 243
 		glsr()->render( 'partials/editor/metabox-categories', [
244 244
 			'post' => $post,
245 245
 			'tax_name' => Application::TAXONOMY,
246 246
 			'taxonomy' => get_taxonomy( Application::TAXONOMY ),
247
-		]);
247
+		] );
248 248
 	}
249 249
 
250 250
 	/**
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public function revertReview()
256 256
 	{
257
-		check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() ));
257
+		check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) );
258 258
 		glsr( ReviewManager::class )->revert( $postId );
259 259
 		$this->redirect( $postId, 52 );
260 260
 	}
@@ -277,13 +277,13 @@  discard block
 block discarded – undo
277 277
 	protected function buildAssignedToTemplate( $assignedTo, WP_Post $post )
278 278
 	{
279 279
 		$assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo );
280
-		if( !( $assignedPost instanceof WP_Post ))return;
280
+		if( !($assignedPost instanceof WP_Post) )return;
281 281
 		return glsr( Html::class )->buildTemplate( 'partials/editor/assigned-post', [
282 282
 			'context' => [
283 283
 				'data.url' => (string)get_permalink( $assignedPost ),
284 284
 				'data.title' => get_the_title( $assignedPost ),
285 285
 			],
286
-		]);
286
+		] );
287 287
 	}
288 288
 
289 289
 	/**
@@ -303,13 +303,13 @@  discard block
 block discarded – undo
303 303
 				'class' => 'button button-large',
304 304
 				'href' => $revertUrl,
305 305
 				'id' => 'revert',
306
-			]);
306
+			] );
307 307
 		}
308 308
 		return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [
309 309
 			'class' => 'button button-large',
310 310
 			'disabled' => true,
311 311
 			'id' => 'revert',
312
-		]);
312
+		] );
313 313
 	}
314 314
 
315 315
 	/**
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 		$reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes )
323 323
 			? glsr()->reviewTypes[$review->review_type]
324 324
 			: __( 'Unknown', 'site-reviews' );
325
-		if( !empty( $review->url )) {
325
+		if( !empty($review->url) ) {
326 326
 			$reviewType = glsr( Builder::class )->a( $reviewType, [
327 327
 				'href' => $review->url,
328 328
 				'target' => '_blank',
329
-			]);
329
+			] );
330 330
 		}
331 331
 		return $reviewType;
332 332
 	}
@@ -345,16 +345,16 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	protected function normalizeDetailsMetaBox( Review $review )
347 347
 	{
348
-		$user = empty( $review->user_id )
348
+		$user = empty($review->user_id)
349 349
 			? __( 'Unregistered user', 'site-reviews' )
350 350
 			: glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [
351 351
 				'href' => get_author_posts_url( $review->user_id ),
352
-			]);
353
-		$email = empty( $review->email )
352
+			] );
353
+		$email = empty($review->email)
354 354
 			? '&mdash;'
355 355
 			: glsr( Builder::class )->a( $review->email, [
356 356
 				'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ),
357
-			]);
357
+			] );
358 358
 		$metabox = [
359 359
 			__( 'Rating', 'site-reviews' ) => glsr( Html::class )->buildPartial( 'star-rating', ['rating' => $review->rating] ),
360 360
 			__( 'Type', 'site-reviews' ) => $this->getReviewType( $review ),
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 			__( 'IP Address', 'site-reviews' ) => $review->ip_address,
366 366
 			__( 'Avatar', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ),
367 367
 		];
368
-		return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ));
368
+		return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ) );
369 369
 	}
370 370
 
371 371
 	/**
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 		$redirectUri = $hasReferer
383 383
 			? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer )
384 384
 			: get_edit_post_link( $postId );
385
-		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ));
385
+		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) );
386 386
 		exit;
387 387
 	}
388 388
 }
Please login to merge, or discard this patch.
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -94,7 +94,9 @@  discard block
 block discarded – undo
94 94
 		if( !in_array( $metaKey, ['rating', 'review_type'] )
95 95
 			|| get_post_field( 'post_type', $postId ) != Application::POST_TYPE
96 96
 			|| get_post_field( 'post_status', $postId ) != 'publish' // only fire on an existing published post
97
- 		)return;
97
+ 		) {
98
+			return;
99
+		}
98 100
 		glsr( Metaboxes::class )->onBeforeUpdateReview( get_post( $postId ), $metaKey, $metaValue );
99 101
 	}
100 102
 
@@ -129,7 +131,9 @@  discard block
 block discarded – undo
129 131
 	{
130 132
 		if( in_array( $oldStatus, ['new', $newStatus] )
131 133
 			|| $post->post_type != Application::POST_TYPE
132
-		)return;
134
+		) {
135
+			return;
136
+		}
133 137
 		glsr( Metaboxes::class )->onReviewStatusChange( $newStatus, $post );
134 138
 	}
135 139
 
@@ -150,7 +154,9 @@  discard block
 block discarded – undo
150 154
 	 */
151 155
 	public function registerMetaBoxes( $postType )
152 156
 	{
153
-		if( $postType != Application::POST_TYPE )return;
157
+		if( $postType != Application::POST_TYPE ) {
158
+			return;
159
+		}
154 160
 		add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' );
155 161
 		add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' );
156 162
 		add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' );
@@ -180,7 +186,9 @@  discard block
 block discarded – undo
180 186
 	 */
181 187
 	public function renderAssignedToMetabox( WP_Post $post )
182 188
 	{
183
-		if( !$this->isReviewPostType( $post ))return;
189
+		if( !$this->isReviewPostType( $post )) {
190
+			return;
191
+		}
184 192
 		$assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true );
185 193
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
186 194
 		glsr()->render( 'partials/editor/metabox-assigned-to', [
@@ -195,7 +203,9 @@  discard block
 block discarded – undo
195 203
 	 */
196 204
 	public function renderDetailsMetaBox( WP_Post $post )
197 205
 	{
198
-		if( !$this->isReviewPostType( $post ))return;
206
+		if( !$this->isReviewPostType( $post )) {
207
+			return;
208
+		}
199 209
 		$review = glsr( ReviewManager::class )->single( $post );
200 210
 		glsr()->render( 'partials/editor/metabox-details', [
201 211
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
@@ -209,7 +219,9 @@  discard block
 block discarded – undo
209 219
 	 */
210 220
 	public function renderPinnedInPublishMetaBox()
211 221
 	{
212
-		if( !$this->isReviewPostType( get_post() ))return;
222
+		if( !$this->isReviewPostType( get_post() )) {
223
+			return;
224
+		}
213 225
 		glsr( Html::class )->renderTemplate( 'partials/editor/pinned', [
214 226
 			'context' => [
215 227
 				'no' => __( 'No', 'site-reviews' ),
@@ -225,7 +237,9 @@  discard block
 block discarded – undo
225 237
 	 */
226 238
 	public function renderResponseMetaBox( WP_Post $post )
227 239
 	{
228
-		if( !$this->isReviewPostType( $post ))return;
240
+		if( !$this->isReviewPostType( $post )) {
241
+			return;
242
+		}
229 243
 		wp_nonce_field( 'response', '_nonce-response', false );
230 244
 		glsr()->render( 'partials/editor/metabox-response', [
231 245
 			'response' => get_post_meta( $post->ID, 'response', true ),
@@ -239,7 +253,9 @@  discard block
 block discarded – undo
239 253
 	 */
240 254
 	public function renderTaxonomyMetabox( WP_Post $post )
241 255
 	{
242
-		if( !$this->isReviewPostType( $post ))return;
256
+		if( !$this->isReviewPostType( $post )) {
257
+			return;
258
+		}
243 259
 		glsr()->render( 'partials/editor/metabox-categories', [
244 260
 			'post' => $post,
245 261
 			'tax_name' => Application::TAXONOMY,
@@ -277,7 +293,9 @@  discard block
 block discarded – undo
277 293
 	protected function buildAssignedToTemplate( $assignedTo, WP_Post $post )
278 294
 	{
279 295
 		$assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo );
280
-		if( !( $assignedPost instanceof WP_Post ))return;
296
+		if( !( $assignedPost instanceof WP_Post )) {
297
+			return;
298
+		}
281 299
 		return glsr( Html::class )->buildTemplate( 'partials/editor/assigned-post', [
282 300
 			'context' => [
283 301
 				'data.url' => (string)get_permalink( $assignedPost ),
@@ -318,7 +336,9 @@  discard block
 block discarded – undo
318 336
 	 */
319 337
 	protected function getReviewType( $review )
320 338
 	{
321
-		if( count( glsr()->reviewTypes ) < 2 )return;
339
+		if( count( glsr()->reviewTypes ) < 2 ) {
340
+			return;
341
+		}
322 342
 		$reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes )
323 343
 			? glsr()->reviewTypes[$review->review_type]
324 344
 			: __( 'Unknown', 'site-reviews' );
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function approve()
23 23
 	{
24
-		check_admin_referer( 'approve-review_'.( $postId = $this->getPostId() ));
25
-		wp_update_post([
24
+		check_admin_referer( 'approve-review_'.($postId = $this->getPostId()) );
25
+		wp_update_post( [
26 26
 			'ID' => $postId,
27 27
 			'post_status' => 'publish',
28
-		]);
28
+		] );
29 29
 		wp_safe_redirect( wp_get_referer() );
30 30
 		exit;
31 31
 	}
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
56 56
 		foreach( $postTypeColumns as $key => &$value ) {
57
-			if( !array_key_exists( $key, $columns ) || !empty( $value ))continue;
57
+			if( !array_key_exists( $key, $columns ) || !empty($value) )continue;
58 58
 			$value = $columns[$key];
59 59
 		}
60
-		if( count( glsr( Database::class )->getReviewsMeta( 'review_type' )) < 2 ) {
61
-			unset( $postTypeColumns['review_type'] );
60
+		if( count( glsr( Database::class )->getReviewsMeta( 'review_type' ) ) < 2 ) {
61
+			unset($postTypeColumns['review_type']);
62 62
 		}
63 63
 		return array_filter( $postTypeColumns, 'strlen' );
64 64
 	}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function filterPostStates( array $postStates, WP_Post $post ) {
96 96
 		if( $post->post_type == Application::POST_TYPE
97
-			&& array_key_exists( 'pending', $postStates )) {
97
+			&& array_key_exists( 'pending', $postStates ) ) {
98 98
 			$postStates['pending'] = __( 'Unapproved', 'site-reviews' );
99 99
 		}
100 100
 		return $postStates;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		if( $post->post_type != Application::POST_TYPE || $post->post_status == 'trash' ) {
110 110
 			return $actions;
111 111
 		}
112
-		unset( $actions['inline hide-if-no-js'] ); //Remove Quick-edit
112
+		unset($actions['inline hide-if-no-js']); //Remove Quick-edit
113 113
 		$rowActions = [
114 114
 			'approve' => esc_attr__( 'Approve', 'site-reviews' ),
115 115
 			'unapprove' => esc_attr__( 'Unapprove', 'site-reviews' ),
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 					admin_url( 'post.php?post='.$post->ID.'&action='.$key ),
124 124
 					$key.'-review_'.$post->ID
125 125
 				),
126
-			]);
126
+			] );
127 127
 		}
128 128
 		return $newActions + $actions;
129 129
 	}
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	public function filterSortableColumns( array $columns )
136 136
 	{
137 137
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
138
-		unset( $postTypeColumns['cb'] );
138
+		unset($postTypeColumns['cb']);
139 139
 		foreach( $postTypeColumns as $key => $value ) {
140
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
140
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ) )continue;
141 141
 			$columns[$key] = $key;
142 142
 		}
143 143
 		return $columns;
@@ -155,18 +155,18 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function filterStatusText( $translation, $single, $plural, $number, $domain )
157 157
 	{
158
-		if( $this->canModifyTranslation( $domain )) {
158
+		if( $this->canModifyTranslation( $domain ) ) {
159 159
 			$strings = [
160 160
 				'Published' => __( 'Approved', 'site-reviews' ),
161 161
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
162 162
 			];
163 163
 			foreach( $strings as $search => $replace ) {
164 164
 				if( strpos( $single, $search ) === false )continue;
165
-				$translation = $this->getTranslation([
165
+				$translation = $this->getTranslation( [
166 166
 					'number' => $number,
167 167
 					'plural' => str_replace( $search, $replace, $plural ),
168 168
 					'single' => str_replace( $search, $replace, $single ),
169
-				]);
169
+				] );
170 170
 			}
171 171
 		}
172 172
 		return $translation;
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	public function saveBulkEditFields( $postId )
215 215
 	{
216
-		if( !current_user_can( 'edit_posts' ))return;
216
+		if( !current_user_can( 'edit_posts' ) )return;
217 217
 		$assignedTo = filter_input( INPUT_GET, 'assigned_to' );
218
-		if( $assignedTo && get_post( $assignedTo )) {
218
+		if( $assignedTo && get_post( $assignedTo ) ) {
219 219
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
220 220
 		}
221 221
 	}
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function setQueryForColumn( WP_Query $query )
228 228
 	{
229
-		if( !$this->hasPermission( $query ))return;
229
+		if( !$this->hasPermission( $query ) )return;
230 230
 		$this->setMetaQuery( $query, [
231 231
 			'rating', 'review_type',
232
-		]);
232
+		] );
233 233
 		$this->setOrderby( $query );
234 234
 	}
235 235
 
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	public function unapprove()
241 241
 	{
242
-		check_admin_referer( 'unapprove-review_'.( $postId = $this->getPostId() ));
243
-		wp_update_post([
242
+		check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) );
243
+		wp_update_post( [
244 244
 			'ID' => $postId,
245 245
 			'post_status' => 'pending',
246
-		]);
246
+		] );
247 247
 		wp_safe_redirect( wp_get_referer() );
248 248
 		exit;
249 249
 	}
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 			'single' => '',
274 274
 			'text' => '',
275 275
 		];
276
-		$args = (object) wp_parse_args( $args, $defaults );
276
+		$args = (object)wp_parse_args( $args, $defaults );
277 277
 		$translations = get_translations_for_domain( Application::ID );
278 278
 		return $args->text
279 279
 			? $translations->translate( $args->text )
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
299 299
 	{
300 300
 		foreach( $metaKeys as $key ) {
301
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
301
+			if( !($value = filter_input( INPUT_GET, $key )) )continue;
302 302
 			$metaQuery = (array)$query->get( 'meta_query' );
303 303
 			$metaQuery[] = [
304 304
 				'key' => $key,
@@ -315,8 +315,8 @@  discard block
 block discarded – undo
315 315
 	{
316 316
 		$orderby = $query->get( 'orderby' );
317 317
 		$columns = glsr()->postTypeColumns[Application::POST_TYPE];
318
-		unset( $columns['cb'], $columns['title'], $columns['date'] );
319
-		if( in_array( $orderby, array_keys( $columns ))) {
318
+		unset($columns['cb'], $columns['title'], $columns['date']);
319
+		if( in_array( $orderby, array_keys( $columns ) ) ) {
320 320
 			$query->set( 'meta_key', $orderby );
321 321
 			$query->set( 'orderby', 'meta_value' );
322 322
 		}
Please login to merge, or discard this patch.
Braces   +20 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
56 56
 		foreach( $postTypeColumns as $key => &$value ) {
57
-			if( !array_key_exists( $key, $columns ) || !empty( $value ))continue;
57
+			if( !array_key_exists( $key, $columns ) || !empty( $value )) {
58
+				continue;
59
+			}
58 60
 			$value = $columns[$key];
59 61
 		}
60 62
 		if( count( glsr( Database::class )->getReviewsMeta( 'review_type' )) < 2 ) {
@@ -92,7 +94,8 @@  discard block
 block discarded – undo
92 94
 	 * @return array
93 95
 	 * @filter display_post_states
94 96
 	 */
95
-	public function filterPostStates( array $postStates, WP_Post $post ) {
97
+	public function filterPostStates( array $postStates, WP_Post $post )
98
+	{
96 99
 		if( $post->post_type == Application::POST_TYPE
97 100
 			&& array_key_exists( 'pending', $postStates )) {
98 101
 			$postStates['pending'] = __( 'Unapproved', 'site-reviews' );
@@ -137,7 +140,9 @@  discard block
 block discarded – undo
137 140
 		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
138 141
 		unset( $postTypeColumns['cb'] );
139 142
 		foreach( $postTypeColumns as $key => $value ) {
140
-			if( glsr( Helper::class )->startsWith( 'taxonomy', $key ))continue;
143
+			if( glsr( Helper::class )->startsWith( 'taxonomy', $key )) {
144
+				continue;
145
+			}
141 146
 			$columns[$key] = $key;
142 147
 		}
143 148
 		return $columns;
@@ -161,7 +166,9 @@  discard block
 block discarded – undo
161 166
 				'Pending' => __( 'Unapproved', 'site-reviews' ),
162 167
 			];
163 168
 			foreach( $strings as $search => $replace ) {
164
-				if( strpos( $single, $search ) === false )continue;
169
+				if( strpos( $single, $search ) === false ) {
170
+					continue;
171
+				}
165 172
 				$translation = $this->getTranslation([
166 173
 					'number' => $number,
167 174
 					'plural' => str_replace( $search, $replace, $plural ),
@@ -213,7 +220,9 @@  discard block
 block discarded – undo
213 220
 	 */
214 221
 	public function saveBulkEditFields( $postId )
215 222
 	{
216
-		if( !current_user_can( 'edit_posts' ))return;
223
+		if( !current_user_can( 'edit_posts' )) {
224
+			return;
225
+		}
217 226
 		$assignedTo = filter_input( INPUT_GET, 'assigned_to' );
218 227
 		if( $assignedTo && get_post( $assignedTo )) {
219 228
 			update_post_meta( $postId, 'assigned_to', $assignedTo );
@@ -226,7 +235,9 @@  discard block
 block discarded – undo
226 235
 	 */
227 236
 	public function setQueryForColumn( WP_Query $query )
228 237
 	{
229
-		if( !$this->hasPermission( $query ))return;
238
+		if( !$this->hasPermission( $query )) {
239
+			return;
240
+		}
230 241
 		$this->setMetaQuery( $query, [
231 242
 			'rating', 'review_type',
232 243
 		]);
@@ -298,7 +309,9 @@  discard block
 block discarded – undo
298 309
 	protected function setMetaQuery( WP_Query $query, array $metaKeys )
299 310
 	{
300 311
 		foreach( $metaKeys as $key ) {
301
-			if( !( $value = filter_input( INPUT_GET, $key )))continue;
312
+			if( !( $value = filter_input( INPUT_GET, $key ))) {
313
+				continue;
314
+			}
302 315
 			$metaQuery = (array)$query->get( 'meta_query' );
303 316
 			$metaQuery[] = [
304 317
 				'key' => $key,
Please login to merge, or discard this patch.