Passed
Push — hotfix/fix-counts ( 673622...5fa6b5 )
by Paul
05:31
created
plugin/Modules/Validator/ValidateReview.php 2 patches
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -175,8 +175,12 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	protected function validateAkismet()
177 177
 	{
178
-		if( !empty( $this->error ))return;
179
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
178
+		if( !empty( $this->error )) {
179
+			return;
180
+		}
181
+		if( !glsr( Akismet::class )->isSpam( $this->request )) {
182
+			return;
183
+		}
180 184
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission (consider adding the IP address to the blacklist):' );
181 185
 		$this->error = __( 'This review has been flagged as possible spam and cannot be submitted.', 'site-reviews' );
182 186
 	}
@@ -186,8 +190,12 @@  discard block
 block discarded – undo
186 190
 	 */
187 191
 	protected function validateBlacklist()
188 192
 	{
189
-		if( !empty( $this->error ))return;
190
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
193
+		if( !empty( $this->error )) {
194
+			return;
195
+		}
196
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) {
197
+			return;
198
+		}
191 199
 		$blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' );
192 200
 		if( $blacklistAction == 'reject' ) {
193 201
 			$this->setSessionValues( 'errors', [], 'Blacklisted submission detected:' );
@@ -202,9 +210,13 @@  discard block
 block discarded – undo
202 210
 	 */
203 211
 	protected function validateCustom()
204 212
 	{
205
-		if( !empty( $this->error ))return;
213
+		if( !empty( $this->error )) {
214
+			return;
215
+		}
206 216
 		$validated = apply_filters( 'site-reviews/validate/custom', true, $this->request );
207
-		if( $validated === true )return;
217
+		if( $validated === true ) {
218
+			return;
219
+		}
208 220
 		$this->setSessionValues( 'errors', [] );
209 221
 		$this->setSessionValues( 'values', $this->request );
210 222
 		$this->error = is_string( $validated )
@@ -217,8 +229,12 @@  discard block
 block discarded – undo
217 229
 	 */
218 230
 	protected function validateHoneyPot()
219 231
 	{
220
-		if( !empty( $this->error ))return;
221
-		if( empty( $this->request['gotcha'] ))return;
232
+		if( !empty( $this->error )) {
233
+			return;
234
+		}
235
+		if( empty( $this->request['gotcha'] )) {
236
+			return;
237
+		}
222 238
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
223 239
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
224 240
 	}
@@ -228,9 +244,13 @@  discard block
 block discarded – undo
228 244
 	 */
229 245
 	protected function validateRecaptcha()
230 246
 	{
231
-		if( !empty( $this->error ))return;
247
+		if( !empty( $this->error )) {
248
+			return;
249
+		}
232 250
 		$status = $this->getRecaptchaStatus();
233
-		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ))return;
251
+		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] )) {
252
+			return;
253
+		}
234 254
 		if( $status == static::RECAPTCHA_EMPTY ) {
235 255
 			$this->setSessionValues( 'recaptcha', 'unset' );
236 256
 			$this->recaptchaIsUnset = true;
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$this->validateBlacklist();
68 68
 		$this->validateAkismet();
69 69
 		$this->validateRecaptcha();
70
-		if( !empty( $this->error )) {
70
+		if( !empty($this->error) ) {
71 71
 			$this->setSessionValues( 'message', $this->error );
72 72
 		}
73 73
 		return $this;
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 		if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) {
92 92
 			return static::RECAPTCHA_DISABLED;
93 93
 		}
94
-		if( empty( $this->request['_recaptcha-token'] )) {
95
-			return $this->request['_counter'] < intval( apply_filters( 'site-reviews/recaptcha/timeout', 5 ))
94
+		if( empty($this->request['_recaptcha-token']) ) {
95
+			return $this->request['_counter'] < intval( apply_filters( 'site-reviews/recaptcha/timeout', 5 ) )
96 96
 				? static::RECAPTCHA_EMPTY
97 97
 				: static::RECAPTCHA_FAILED;
98 98
 		}
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	protected function getRecaptchaTokenStatus()
106 106
 	{
107
-		$endpoint = add_query_arg([
107
+		$endpoint = add_query_arg( [
108 108
 			'remoteip' => glsr( Helper::class )->getIpAddress(),
109 109
 			'response' => $this->request['_recaptcha-token'],
110 110
 			'secret' => $this->getOption( 'settings.submissions.recaptcha.secret' ),
111 111
 		], static::RECAPTCHA_ENDPOINT );
112
-		if( is_wp_error( $response = wp_remote_get( $endpoint ))) {
112
+		if( is_wp_error( $response = wp_remote_get( $endpoint ) ) ) {
113 113
 			glsr_log()->error( $response->get_error_message() );
114 114
 			return static::RECAPTCHA_FAILED;
115 115
 		}
116
-		$response = json_decode( wp_remote_retrieve_body( $response ));
117
-		if( !empty( $response->success )) {
116
+		$response = json_decode( wp_remote_retrieve_body( $response ) );
117
+		if( !empty($response->success) ) {
118 118
 			return boolval( $response->success )
119 119
 				? static::RECAPTCHA_VALID
120 120
 				: static::RECAPTCHA_INVALID;
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 	{
133 133
 		$rules = array_intersect_key(
134 134
 			apply_filters( 'site-reviews/validation/rules', static::VALIDATION_RULES, $request ),
135
-			array_flip( $this->getOption( 'settings.submissions.required', [] ))
135
+			array_flip( $this->getOption( 'settings.submissions.required', [] ) )
136 136
 		);
137
-		$excluded = explode( ',', glsr_get( $request, 'excluded' ));
138
-		return array_diff_key( $rules, array_flip( $excluded ));
137
+		$excluded = explode( ',', glsr_get( $request, 'excluded' ) );
138
+		return array_diff_key( $rules, array_flip( $excluded ) );
139 139
 	}
140 140
 
141 141
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	{
146 146
 		$rules = $this->getValidationRules( $request );
147 147
 		$errors = glsr( Validator::class )->validate( $request, $rules );
148
-		if( empty( $errors )) {
148
+		if( empty($errors) ) {
149 149
 			return true;
150 150
 		}
151 151
 		$this->setSessionValues( 'errors', $errors );
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	protected function setSessionValues( $type, $value, $loggedMessage = '' )
163 163
 	{
164 164
 		glsr( Session::class )->set( $this->form_id.$type, $value );
165
-		if( !empty( $loggedMessage )) {
165
+		if( !empty($loggedMessage) ) {
166 166
 			glsr_log()->warning( $loggedMessage )->debug( $this->request );
167 167
 		}
168 168
 	}
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	 */
173 173
 	protected function validateAkismet()
174 174
 	{
175
-		if( !empty( $this->error ))return;
176
-		if( !glsr( Akismet::class )->isSpam( $this->request ))return;
175
+		if( !empty($this->error) )return;
176
+		if( !glsr( Akismet::class )->isSpam( $this->request ) )return;
177 177
 		$this->setSessionValues( 'errors', [], 'Akismet caught a spam submission (consider adding the IP address to the blacklist):' );
178 178
 		$this->error = __( 'This review has been flagged as possible spam and cannot be submitted.', 'site-reviews' );
179 179
 	}
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	protected function validateBlacklist()
185 185
 	{
186
-		if( !empty( $this->error ))return;
187
-		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return;
186
+		if( !empty($this->error) )return;
187
+		if( !glsr( Blacklist::class )->isBlacklisted( $this->request ) )return;
188 188
 		$blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' );
189 189
 		if( $blacklistAction == 'reject' ) {
190 190
 			$this->setSessionValues( 'errors', [], 'Blacklisted submission detected:' );
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	protected function validateCustom()
201 201
 	{
202
-		if( !empty( $this->error ))return;
202
+		if( !empty($this->error) )return;
203 203
 		$validated = apply_filters( 'site-reviews/validate/custom', true, $this->request );
204 204
 		if( $validated === true )return;
205 205
 		$this->setSessionValues( 'errors', [] );
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	protected function validateHoneyPot()
216 216
 	{
217
-		if( !empty( $this->error ))return;
218
-		if( empty( $this->request['gotcha'] ))return;
217
+		if( !empty($this->error) )return;
218
+		if( empty($this->request['gotcha']) )return;
219 219
 		$this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' );
220 220
 		$this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
221 221
 	}
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	protected function validateRecaptcha()
227 227
 	{
228
-		if( !empty( $this->error ))return;
228
+		if( !empty($this->error) )return;
229 229
 		$status = $this->getRecaptchaStatus();
230
-		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ))return;
230
+		if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ) )return;
231 231
 		if( $status == static::RECAPTCHA_EMPTY ) {
232 232
 			$this->setSessionValues( 'recaptcha', 'unset' );
233 233
 			$this->recaptchaIsUnset = true;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	protected function validateRequest( array $request )
249 249
 	{
250
-		if( !$this->isRequestValid( $request )) {
250
+		if( !$this->isRequestValid( $request ) ) {
251 251
 			$this->error = __( 'Please fix the submission errors.', 'site-reviews' );
252 252
 			return $request;
253 253
 		}
Please login to merge, or discard this patch.
plugin/Application.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,9 @@  discard block
 block discarded – undo
60 60
 	public function catchFatalError()
61 61
 	{
62 62
 		$error = error_get_last();
63
-		if( $error['type'] !== E_ERROR || strpos( $error['message'], $this->path() ) === false )return;
63
+		if( $error['type'] !== E_ERROR || strpos( $error['message'], $this->path() ) === false ) {
64
+			return;
65
+		}
64 66
 		glsr_log()->error( $error['message'] );
65 67
 	}
66 68
 
@@ -111,7 +113,9 @@  discard block
 block discarded – undo
111 113
 		$filePaths[] = $this->path( $view );
112 114
 		$filePaths[] = $this->path( 'views/'.$view );
113 115
 		foreach( $filePaths as $file ) {
114
-			if( !file_exists( $file ))continue;
116
+			if( !file_exists( $file )) {
117
+				continue;
118
+			}
115 119
 			return $file;
116 120
 		}
117 121
 	}
@@ -215,7 +219,9 @@  discard block
 block discarded – undo
215 219
 	 */
216 220
 	public function scheduleCronJob()
217 221
 	{
218
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
222
+		if( wp_next_scheduled( static::CRON_EVENT )) {
223
+			return;
224
+		}
219 225
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
220 226
 	}
221 227
 
@@ -255,7 +261,9 @@  discard block
 block discarded – undo
255 261
 			|| !in_array( plugin_basename( $this->file ), $data['plugins'] )
256 262
 			|| $data['action'] != 'update'
257 263
 			|| $data['type'] != 'plugin'
258
-		)return;
264
+		) {
265
+			return;
266
+		}
259 267
 		$this->upgrade();
260 268
 	}
261 269
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	public function __construct()
34 34
 	{
35 35
 		static::$instance = $this;
36
-		$this->file = realpath( trailingslashit( dirname( __DIR__ )).static::ID.'.php' );
36
+		$this->file = realpath( trailingslashit( dirname( __DIR__ ) ).static::ID.'.php' );
37 37
 		$plugin = get_file_data( $this->file, [
38 38
 			'languages' => 'Domain Path',
39 39
 			'name' => 'Plugin Name',
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		$constant = $className.'::'.$property;
87 87
 		return defined( $constant )
88
-			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ))
88
+			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ) )
89 89
 			: '';
90 90
 	}
91 91
 
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function file( $view )
105 105
 	{
106
-		$view.= '.php';
106
+		$view .= '.php';
107 107
 		$filePaths = [];
108
-		if( glsr( Helper::class )->startsWith( 'templates/', $view )) {
109
-			$filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ));
108
+		if( glsr( Helper::class )->startsWith( 'templates/', $view ) ) {
109
+			$filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ) );
110 110
 		}
111 111
 		$filePaths[] = $this->path( $view );
112 112
 		$filePaths[] = $this->path( 'views/'.$view );
113 113
 		foreach( $filePaths as $file ) {
114
-			if( !file_exists( $file ))continue;
114
+			if( !file_exists( $file ) )continue;
115 115
 			return $file;
116 116
 		}
117 117
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getDefaults()
123 123
 	{
124
-		if( empty( $this->defaults )) {
124
+		if( empty($this->defaults) ) {
125 125
 			$this->defaults = $this->make( DefaultsManager::class )->get();
126 126
 			$this->upgrade();
127 127
 		}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			'addons' => 'install_plugins',
138 138
 			'settings' => 'manage_options',
139 139
 		];
140
-		return glsr_get( $permissions, $page, $this->constant( 'CAPABILITY' ));
140
+		return glsr_get( $permissions, $page, $this->constant( 'CAPABILITY' ) );
141 141
 	}
142 142
 
143 143
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	public function hasPermission( $page = '' )
147 147
 	{
148 148
 		$isAdmin = $this->isAdmin();
149
-		return !$isAdmin || ( $isAdmin && current_user_can( $this->getPermission( $page )));
149
+		return !$isAdmin || ($isAdmin && current_user_can( $this->getPermission( $page ) ));
150 150
 	}
151 151
 
152 152
 	/**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	{
175 175
 		$path = plugin_dir_path( $this->file );
176 176
 		if( !$realpath ) {
177
-			$path = trailingslashit( WP_PLUGIN_DIR ).basename( dirname( $this->file ));
177
+			$path = trailingslashit( WP_PLUGIN_DIR ).basename( dirname( $this->file ) );
178 178
 		}
179 179
 		$path = trailingslashit( $path ).ltrim( trim( $file ), '/' );
180 180
 		return apply_filters( 'site-reviews/path', $path, $file );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		$types = apply_filters( 'site-reviews/addon/types', [] );
207 207
 		$this->reviewTypes = wp_parse_args( $types, [
208 208
 			'local' => __( 'Local', 'site-reviews' ),
209
-		]);
209
+		] );
210 210
 	}
211 211
 
212 212
 	/**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	{
218 218
 		$view = apply_filters( 'site-reviews/render/view', $view, $data );
219 219
 		$file = apply_filters( 'site-reviews/views/file', $this->file( $view ), $view, $data );
220
-		if( !file_exists( $file )) {
220
+		if( !file_exists( $file ) ) {
221 221
 			glsr_log()->error( 'File not found: '.$file );
222 222
 			return;
223 223
 		}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	public function scheduleCronJob()
233 233
 	{
234
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
234
+		if( wp_next_scheduled( static::CRON_EVENT ) )return;
235 235
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
236 236
 	}
237 237
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function unscheduleCronJob()
251 251
 	{
252
-		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT );
252
+		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT );
253 253
 	}
254 254
 
255 255
 	/**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public function url( $path = '' )
283 283
 	{
284
-		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ));
284
+		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) );
285 285
 		return apply_filters( 'site-reviews/url', $url, $path );
286 286
 	}
287 287
 }
Please login to merge, or discard this patch.
plugin/Review.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@  discard block
 block discarded – undo
36 36
 
37 37
 	public function __construct( WP_Post $post )
38 38
 	{
39
-		if( $post->post_type != Application::POST_TYPE )return;
39
+		if( $post->post_type != Application::POST_TYPE ) {
40
+			return;
41
+		}
40 42
 		$this->content = $post->post_content;
41 43
 		$this->date = $post->post_date;
42 44
 		$this->ID = intval( $post->ID );
@@ -163,7 +165,9 @@  discard block
 block discarded – undo
163 165
 		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
164 166
 		$this->modified = $this->isModified( $properties );
165 167
 		array_walk( $properties, function( $value, $key ) {
166
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
168
+			if( !property_exists( $this, $key ) || isset( $this->$key )) {
169
+				return;
170
+			}
167 171
 			$this->$key = maybe_unserialize( $value );
168 172
 		});
169 173
 	}
@@ -174,7 +178,9 @@  discard block
 block discarded – undo
174 178
 	protected function setTermIds( WP_Post $post )
175 179
 	{
176 180
 		$this->term_ids = [];
177
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
181
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ))) {
182
+			return;
183
+		}
178 184
 		foreach( $terms as $term ) {
179 185
 			$this->term_ids[] = $term->term_id;
180 186
 		}
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function build( array $args = [] )
70 70
 	{
71
-		if( empty( $this->ID )) {
71
+		if( empty($this->ID) ) {
72 72
 			return new ReviewHtml( $this );
73 73
 		}
74 74
 		$partial = glsr( SiteReviewsPartial::class );
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function offsetGet( $key )
94 94
 	{
95
-		if( property_exists( $this, $key )) {
95
+		if( property_exists( $this, $key ) ) {
96 96
 			return $this->$key;
97 97
 		}
98 98
 		return array_key_exists( $key, (array)$this->custom )
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function offsetSet( $key, $value )
109 109
 	{
110
-		if( property_exists( $this, $key )) {
110
+		if( property_exists( $this, $key ) ) {
111 111
 			$this->$key = $value;
112 112
 			return;
113 113
 		}
114
-		if( !is_array( $this->custom )) {
114
+		if( !is_array( $this->custom ) ) {
115 115
 			$this->custom = array_filter( (array)$this->custom );
116 116
 		}
117 117
 		$this->custom[$key] = $value;
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
 			'review_type' => 'local',
157 157
 		];
158 158
 		$meta = array_filter(
159
-			array_map( 'array_shift', array_filter((array)get_post_meta( $post->ID ))),
159
+			array_map( 'array_shift', array_filter( (array)get_post_meta( $post->ID ) ) ),
160 160
 			'strlen'
161 161
 		);
162
-		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
162
+		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) );
163 163
 		$this->modified = $this->isModified( $properties );
164 164
 		array_walk( $properties, function( $value, $key ) {
165
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
165
+			if( !property_exists( $this, $key ) || isset($this->$key) )return;
166 166
 			$this->$key = maybe_unserialize( $value );
167 167
 		});
168 168
 	}
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	protected function setTermIds( WP_Post $post )
174 174
 	{
175 175
 		$this->term_ids = [];
176
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
176
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return;
177 177
 		foreach( $terms as $term ) {
178 178
 			$this->term_ids[] = $term->term_id;
179 179
 		}
Please login to merge, or discard this patch.
plugin/Controllers/PublicController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 	public function filterEnqueuedScripts( $tag, $handle )
34 34
 	{
35 35
 		$scripts = [Application::ID.'/google-recaptcha'];
36
-		if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ))) {
36
+		if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ) ) ) {
37 37
 			$tag = str_replace( ' src=', ' async src=', $tag );
38 38
 		}
39
-		if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ))) {
39
+		if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ) ) ) {
40 40
 			$tag = str_replace( ' src=', ' defer src=', $tag );
41 41
 		}
42 42
 		return $tag;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function filterFieldOrder( array $config )
51 51
 	{
52
-		$order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config ));
52
+		$order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config ) );
53 53
 		return array_intersect_key( array_merge( array_flip( $order ), $config ), $config );
54 54
 	}
55 55
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	{
101 101
 		$validated = glsr( ValidateReview::class )->validate( $request );
102 102
 		$command = new CreateReview( $validated->request );
103
-		if( empty( $validated->error ) && !$validated->recaptchaIsUnset ) {
103
+		if( empty($validated->error) && !$validated->recaptchaIsUnset ) {
104 104
 			$this->execute( $command );
105 105
 		}
106 106
 		return $command;
Please login to merge, or discard this patch.
plugin/Database/ReviewManager.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -125,7 +125,9 @@  discard block
 block discarded – undo
125 125
 				$termId = intval( $termId );
126 126
 			}
127 127
 			$term = term_exists( $termId, Application::TAXONOMY );
128
-			if( !isset( $term['term_id'] ))continue;
128
+			if( !isset( $term['term_id'] )) {
129
+				continue;
130
+			}
129 131
 			$terms[] = $term;
130 132
 		}
131 133
 		return $terms;
@@ -137,7 +139,9 @@  discard block
 block discarded – undo
137 139
 	 */
138 140
 	public function revert( $postId )
139 141
 	{
140
-		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return;
142
+		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE ) {
143
+			return;
144
+		}
141 145
 		delete_post_meta( $postId, '_edit_last' );
142 146
 		$result = wp_update_post([
143 147
 			'ID' => $postId,
@@ -182,7 +186,9 @@  discard block
 block discarded – undo
182 186
 	protected function setTerms( $postId, $termIds )
183 187
 	{
184 188
 		$termIds = $this->normalizeTermIds( $termIds );
185
-		if( empty( $termIds ))return;
189
+		if( empty( $termIds )) {
190
+			return;
191
+		}
186 192
 		$termTaxonomyIds = wp_set_object_terms( $postId, $termIds, Application::TAXONOMY );
187 193
 		if( is_wp_error( $termTaxonomyIds )) {
188 194
 			glsr_log()->error( $termTaxonomyIds->get_error_message() );
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 			'post_type' => Application::POST_TYPE,
40 40
 		];
41 41
 		$postId = wp_insert_post( $postValues, true );
42
-		if( is_wp_error( $postId )) {
42
+		if( is_wp_error( $postId ) ) {
43 43
 			glsr_log()->error( $postId->get_error_message() )->debug( $postValues );
44 44
 			return false;
45 45
 		}
46 46
 		$this->setTerms( $postId, $command->category );
47
-		$review = $this->single( get_post( $postId ));
47
+		$review = $this->single( get_post( $postId ) );
48 48
 		do_action( 'site-reviews/review/created', $review, $command );
49 49
 		return $review;
50 50
 	}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function delete( $metaReviewId )
57 57
 	{
58
-		if( $postId = $this->getPostId( $metaReviewId )) {
58
+		if( $postId = $this->getPostId( $metaReviewId ) ) {
59 59
 			wp_delete_post( $postId, true );
60 60
 		}
61 61
 	}
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 	public function getRatingCounts( array $args = [] )
114 114
 	{
115 115
 		$args = glsr( SiteReviewsSummaryDefaults::class )->filter( $args );
116
-		$counts = glsr( CountsManager::class )->get([
116
+		$counts = glsr( CountsManager::class )->get( [
117 117
 			'post_ids' => glsr( Helper::class )->convertStringToArray( $args['assigned_to'] ),
118 118
 			'term_ids' => $this->normalizeTermIds( $args['category'] ),
119 119
 			'type' => $args['type'],
120
-		]);
120
+		] );
121 121
 		return glsr( CountsManager::class )->flatten( $counts, [
122 122
 			'min' => $args['rating'],
123
-		]);
123
+		] );
124 124
 	}
125 125
 
126 126
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	public function normalizeTermIds( $commaSeparatedTermIds )
131 131
 	{
132 132
 		$termIds = glsr_array_column( $this->normalizeTerms( $commaSeparatedTermIds ), 'term_id' );
133
-		return array_unique( array_map( 'intval', $termIds ));
133
+		return array_unique( array_map( 'intval', $termIds ) );
134 134
 	}
135 135
 
136 136
 	/**
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 		$terms = [];
143 143
 		$termIds = glsr( Helper::class )->convertStringToArray( $commaSeparatedTermIds );
144 144
 		foreach( $termIds as $termId ) {
145
-			if( is_numeric( $termId )) {
145
+			if( is_numeric( $termId ) ) {
146 146
 				$termId = intval( $termId );
147 147
 			}
148 148
 			$term = term_exists( $termId, Application::TAXONOMY );
149
-			if( !isset( $term['term_id'] ))continue;
149
+			if( !isset($term['term_id']) )continue;
150 150
 			$terms[] = $term;
151 151
 		}
152 152
 		return $terms;
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
 	{
161 161
 		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return;
162 162
 		delete_post_meta( $postId, '_edit_last' );
163
-		$result = wp_update_post([
163
+		$result = wp_update_post( [
164 164
 			'ID' => $postId,
165 165
 			'post_content' => get_post_meta( $postId, 'content', true ),
166 166
 			'post_date' => get_post_meta( $postId, 'date', true ),
167 167
 			'post_title' => get_post_meta( $postId, 'title', true ),
168
-		]);
169
-		if( is_wp_error( $result )) {
168
+		] );
169
+		if( is_wp_error( $result ) ) {
170 170
 			glsr_log()->error( $result->get_error_message() );
171 171
 		}
172 172
 	}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	protected function getNewPostStatus( array $review, $isBlacklisted )
191 191
 	{
192 192
 		$requireApproval = glsr( OptionManager::class )->getBool( 'settings.general.require.approval' );
193
-		return $review['review_type'] == 'local' && ( $requireApproval || $isBlacklisted )
193
+		return $review['review_type'] == 'local' && ($requireApproval || $isBlacklisted)
194 194
 			? 'pending'
195 195
 			: 'publish';
196 196
 	}
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
 	protected function setTerms( $postId, $termIds )
204 204
 	{
205 205
 		$termIds = $this->normalizeTermIds( $termIds );
206
-		if( empty( $termIds ))return;
206
+		if( empty($termIds) )return;
207 207
 		$termTaxonomyIds = wp_set_object_terms( $postId, $termIds, Application::TAXONOMY );
208
-		if( is_wp_error( $termTaxonomyIds )) {
208
+		if( is_wp_error( $termTaxonomyIds ) ) {
209 209
 			glsr_log()->error( $termTaxonomyIds->get_error_message() );
210 210
 		}
211 211
 	}
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviews.php 2 patches
Braces   +42 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,7 +67,9 @@  discard block
 block discarded – undo
67 67
 			$field = method_exists( $this, $method )
68 68
 				? $this->$method( $key, $value )
69 69
 				: apply_filters( 'site-reviews/review/build/'.$key, false, $value, $this, $review );
70
-			if( $field === false )continue;
70
+			if( $field === false ) {
71
+				continue;
72
+			}
71 73
 			$renderedFields[$key] = $field;
72 74
 		}
73 75
 		$this->wrap( $renderedFields, $review );
@@ -95,7 +97,9 @@  discard block
 block discarded – undo
95 97
 	 */
96 98
 	public function generateSchema()
97 99
 	{
98
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
100
+		if( !wp_validate_boolean( $this->args['schema'] )) {
101
+			return;
102
+		}
99 103
 		glsr( Schema::class )->store(
100 104
 			glsr( Schema::class )->build( $this->args )
101 105
 		);
@@ -121,9 +125,13 @@  discard block
 block discarded – undo
121 125
 	 */
122 126
 	protected function buildOptionAssignedTo( $key, $value )
123 127
 	{
124
-		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return;
128
+		if( $this->isHidden( $key, 'settings.reviews.assigned_links' )) {
129
+			return;
130
+		}
125 131
 		$post = glsr( Polylang::class )->getPost( $value );
126
-		if( !( $post instanceof WP_Post ))return;
132
+		if( !( $post instanceof WP_Post )) {
133
+			return;
134
+		}
127 135
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
128 136
 			'href' => get_the_permalink( $post->ID ),
129 137
 		]);
@@ -138,7 +146,9 @@  discard block
 block discarded – undo
138 146
 	 */
139 147
 	protected function buildOptionAuthor( $key, $value )
140 148
 	{
141
-		if( $this->isHidden( $key ))return;
149
+		if( $this->isHidden( $key )) {
150
+			return;
151
+		}
142 152
 		return '<span>'.$value.'</span>';
143 153
 	}
144 154
 
@@ -149,7 +159,9 @@  discard block
 block discarded – undo
149 159
 	 */
150 160
 	protected function buildOptionAvatar( $key, $value )
151 161
 	{
152
-		if( $this->isHidden( $key, 'settings.reviews.avatars' ))return;
162
+		if( $this->isHidden( $key, 'settings.reviews.avatars' )) {
163
+			return;
164
+		}
153 165
 		$size = $this->getOption( 'settings.reviews.avatars_size', 40 );
154 166
 		return glsr( Builder::class )->img([
155 167
 			'height' => $size,
@@ -167,7 +179,9 @@  discard block
 block discarded – undo
167 179
 	protected function buildOptionContent( $key, $value )
168 180
 	{
169 181
 		$text = $this->normalizeText( $value );
170
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
182
+		if( $this->isHiddenOrEmpty( $key, $text )) {
183
+			return;
184
+		}
171 185
 		return '<p>'.$text.'</p>';
172 186
 	}
173 187
 
@@ -178,7 +192,9 @@  discard block
 block discarded – undo
178 192
 	 */
179 193
 	protected function buildOptionDate( $key, $value )
180 194
 	{
181
-		if( $this->isHidden( $key ))return;
195
+		if( $this->isHidden( $key )) {
196
+			return;
197
+		}
182 198
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
183 199
 		if( $dateFormat == 'relative' ) {
184 200
 			$date = glsr( Date::class )->relative( $value );
@@ -199,7 +215,9 @@  discard block
 block discarded – undo
199 215
 	 */
200 216
 	protected function buildOptionRating( $key, $value )
201 217
 	{
202
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
218
+		if( $this->isHiddenOrEmpty( $key, $value )) {
219
+			return;
220
+		}
203 221
 		return glsr_star_rating( $value );
204 222
 	}
205 223
 
@@ -210,7 +228,9 @@  discard block
 block discarded – undo
210 228
 	 */
211 229
 	protected function buildOptionResponse( $key, $value )
212 230
 	{
213
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
231
+		if( $this->isHiddenOrEmpty( $key, $value )) {
232
+			return;
233
+		}
214 234
 		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
215 235
 		$text = $this->normalizeText( $value );
216 236
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
@@ -226,7 +246,9 @@  discard block
 block discarded – undo
226 246
 	 */
227 247
 	protected function buildOptionTitle( $key, $value )
228 248
 	{
229
-		if( $this->isHidden( $key ))return;
249
+		if( $this->isHidden( $key )) {
250
+			return;
251
+		}
230 252
 		if( empty( $value )) {
231 253
 			$value = __( 'No Title', 'site-reviews' );
232 254
 		}
@@ -285,9 +307,13 @@  discard block
 block discarded – undo
285 307
 		$words->setText( $text );
286 308
 		$count = 0;
287 309
 		foreach( $words as $offset ){
288
-			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
310
+			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE ) {
311
+				continue;
312
+			}
289 313
 			$count++;
290
-			if( $count != $limit )continue;
314
+			if( $count != $limit ) {
315
+				continue;
316
+			}
291 317
 			return $offset;
292 318
 		}
293 319
 		return strlen( $text );
@@ -363,7 +389,9 @@  discard block
 block discarded – undo
363 389
 		$renderedFields = apply_filters( 'site-reviews/review/wrap', $renderedFields, $review );
364 390
 		array_walk( $renderedFields, function( &$value, $key ) use( $review ) {
365 391
 			$value = apply_filters( 'site-reviews/review/wrap/'.$key, $value, $review );
366
-			if( empty( $value ))return;
392
+			if( empty( $value )) {
393
+				return;
394
+			}
367 395
 			$value = glsr( Builder::class )->div( $value, [
368 396
 				'class' => 'glsr-review-'.$key,
369 397
 			]);
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function generateSchema()
96 96
 	{
97
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
97
+		if( !wp_validate_boolean( $this->args['schema'] ) )return;
98 98
 		glsr( Schema::class )->store(
99 99
 			glsr( Schema::class )->build( $this->args )
100 100
 		);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function isHidden( $key, $path = '' )
109 109
 	{
110
-		$isOptionEnabled = !empty( $path )
110
+		$isOptionEnabled = !empty($path)
111 111
 			? $this->isOptionEnabled( $path )
112 112
 			: true;
113 113
 		return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled;
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function buildOptionAssignedTo( $key, $value )
122 122
 	{
123
-		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ))return;
123
+		if( $this->isHidden( $key, 'settings.reviews.assigned_links' ) )return;
124 124
 		$post = glsr( Polylang::class )->getPost( $value );
125
-		if( !( $post instanceof WP_Post ))return;
125
+		if( !($post instanceof WP_Post) )return;
126 126
 		$permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [
127 127
 			'href' => get_the_permalink( $post->ID ),
128
-		]);
128
+		] );
129 129
 		$assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink );
130 130
 		return '<span>'.$assignedTo.'</span>';
131 131
 	}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	protected function buildOptionAuthor( $key, $value )
139 139
 	{
140
-		if( $this->isHidden( $key ))return;
140
+		if( $this->isHidden( $key ) )return;
141 141
 		return '<span>'.$value.'</span>';
142 142
 	}
143 143
 
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	protected function buildOptionAvatar( $key, $value )
150 150
 	{
151
-		if( $this->isHidden( $key, 'settings.reviews.avatars' ))return;
151
+		if( $this->isHidden( $key, 'settings.reviews.avatars' ) )return;
152 152
 		$size = $this->getOption( 'settings.reviews.avatars_size', 40 );
153
-		return glsr( Builder::class )->img([
153
+		return glsr( Builder::class )->img( [
154 154
 			'height' => $size,
155 155
 			'src' => $this->generateAvatar( $value ),
156 156
 			'style' => sprintf( 'width:%1$spx; height:%1$spx;', $size ),
157 157
 			'width' => $size,
158
-		]);
158
+		] );
159 159
 	}
160 160
 
161 161
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	protected function buildOptionContent( $key, $value )
167 167
 	{
168 168
 		$text = $this->normalizeText( $value );
169
-		if( $this->isHiddenOrEmpty( $key, $text ))return;
169
+		if( $this->isHiddenOrEmpty( $key, $text ) )return;
170 170
 		return '<p>'.$text.'</p>';
171 171
 	}
172 172
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	protected function buildOptionDate( $key, $value )
179 179
 	{
180
-		if( $this->isHidden( $key ))return;
180
+		if( $this->isHidden( $key ) )return;
181 181
 		$dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' );
182 182
 		if( $dateFormat == 'relative' ) {
183 183
 			$date = glsr( Date::class )->relative( $value );
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 			$format = $dateFormat == 'custom'
187 187
 				? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' )
188 188
 				: (string)get_option( 'date_format' );
189
-			$date = date_i18n( $format, strtotime( $value ));
189
+			$date = date_i18n( $format, strtotime( $value ) );
190 190
 		}
191 191
 		return '<span>'.$date.'</span>';
192 192
 	}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	protected function buildOptionRating( $key, $value )
200 200
 	{
201
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
201
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
202 202
 		return glsr_star_rating( $value );
203 203
 	}
204 204
 
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function buildOptionResponse( $key, $value )
211 211
 	{
212
-		if( $this->isHiddenOrEmpty( $key, $value ))return;
213
-		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ));
212
+		if( $this->isHiddenOrEmpty( $key, $value ) )return;
213
+		$title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) );
214 214
 		$text = $this->normalizeText( $value );
215 215
 		$text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>';
216 216
 		$response = glsr( Builder::class )->div( $text, ['class' => 'glsr-review-response-inner'] );
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	protected function buildOptionTitle( $key, $value )
227 227
 	{
228
-		if( $this->isHidden( $key ))return;
229
-		if( empty( $value )) {
228
+		if( $this->isHidden( $key ) )return;
229
+		if( empty($value) ) {
230 230
 			$value = __( 'No Title', 'site-reviews' );
231 231
 		}
232 232
 		return '<h3>'.$value.'</h3>';
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 			return $avatarUrl;
243 243
 		}
244 244
 		$authorIdOrEmail = get_the_author_meta( 'ID', $this->current->user_id );
245
-		if( empty( $authorIdOrEmail )) {
245
+		if( empty($authorIdOrEmail) ) {
246 246
 			$authorIdOrEmail = $this->current->email;
247 247
 		}
248
-		if( $newAvatar = get_avatar_url( $authorIdOrEmail )) {
248
+		if( $newAvatar = get_avatar_url( $authorIdOrEmail ) ) {
249 249
 			return $newAvatar;
250 250
 		}
251 251
 		return $avatarUrl;
@@ -257,18 +257,18 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	protected function getExcerpt( $text )
259 259
 	{
260
-		$limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ));
260
+		$limit = intval( $this->getOption( 'settings.reviews.excerpts_length', 55 ) );
261 261
 		$split = extension_loaded( 'intl' )
262 262
 			? $this->getExcerptIntlSplit( $text, $limit )
263 263
 			: $this->getExcerptSplit( $text, $limit );
264 264
 		$hiddenText = substr( $text, $split );
265
-		if( !empty( $hiddenText )) {
265
+		if( !empty($hiddenText) ) {
266 266
 			$showMore = glsr( Builder::class )->span( $hiddenText, [
267 267
 				'class' => 'glsr-hidden glsr-hidden-text',
268 268
 				'data-show-less' => __( 'Show less', 'site-reviews' ),
269 269
 				'data-show-more' => __( 'Show more', 'site-reviews' ),
270
-			]);
271
-			$text = ltrim( substr( $text, 0, $split )).$showMore;
270
+			] );
271
+			$text = ltrim( substr( $text, 0, $split ) ).$showMore;
272 272
 		}
273 273
 		return $text;
274 274
 	}
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		$words = IntlRuleBasedBreakIterator::createWordInstance( '' );
284 284
 		$words->setText( $text );
285 285
 		$count = 0;
286
-		foreach( $words as $offset ){
286
+		foreach( $words as $offset ) {
287 287
 			if( $words->getRuleStatus() === IntlRuleBasedBreakIterator::WORD_NONE )continue;
288 288
 			$count++;
289 289
 			if( $count != $limit )continue;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	protected function getExcerptSplit( $text, $limit )
301 301
 	{
302 302
 		if( str_word_count( $text, 0 ) > $limit ) {
303
-			$words = array_keys( str_word_count( $text, 2 ));
303
+			$words = array_keys( str_word_count( $text, 2 ) );
304 304
 			return $words[$limit];
305 305
 		}
306 306
 		return strlen( $text );
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	protected function getOption( $path, $fallback = '' )
315 315
 	{
316
-		if( array_key_exists( $path, $this->options )) {
316
+		if( array_key_exists( $path, $this->options ) ) {
317 317
 			return $this->options[$path];
318 318
 		}
319 319
 		return $fallback;
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 */
327 327
 	protected function isHiddenOrEmpty( $key, $value )
328 328
 	{
329
-		return $this->isHidden( $key ) || empty( $value );
329
+		return $this->isHidden( $key ) || empty($value);
330 330
 	}
331 331
 
332 332
 	/**
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
 	protected function normalizeText( $text )
346 346
 	{
347 347
 		$text = wp_kses( $text, wp_kses_allowed_html() );
348
-		$text = convert_smilies( strip_shortcodes( $text ));
348
+		$text = convert_smilies( strip_shortcodes( $text ) );
349 349
 		$text = str_replace( ']]>', ']]&gt;', $text );
350 350
 		$text = preg_replace( '/(\R){2,}/', '$1', $text );
351
-		if( $this->isOptionEnabled( 'settings.reviews.excerpts' )) {
351
+		if( $this->isOptionEnabled( 'settings.reviews.excerpts' ) ) {
352 352
 			$text = $this->getExcerpt( $text );
353 353
 		}
354
-		return wptexturize( nl2br( $text ));
354
+		return wptexturize( nl2br( $text ) );
355 355
 	}
356 356
 
357 357
 	/**
@@ -360,12 +360,12 @@  discard block
 block discarded – undo
360 360
 	protected function wrap( array &$renderedFields, Review $review )
361 361
 	{
362 362
 		$renderedFields = apply_filters( 'site-reviews/review/wrap', $renderedFields, $review );
363
-		array_walk( $renderedFields, function( &$value, $key ) use( $review ) {
363
+		array_walk( $renderedFields, function( &$value, $key ) use($review) {
364 364
 			$value = apply_filters( 'site-reviews/review/wrap/'.$key, $value, $review );
365
-			if( empty( $value ))return;
365
+			if( empty($value) )return;
366 366
 			$value = glsr( Builder::class )->div( $value, [
367 367
 				'class' => 'glsr-review-'.$key,
368
-			]);
368
+			] );
369 369
 		});
370 370
 	}
371 371
 }
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController/Columns.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		if( $assignedPost instanceof WP_Post && $assignedPost->post_status == 'publish' ) {
22 22
 			$column = glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [
23 23
 				'href' => (string)get_the_permalink( $assignedPost->ID ),
24
-			]);
24
+			] );
25 25
 		}
26 26
 		return $column;
27 27
 	}
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 		$pinned = get_post_meta( $postId, 'pinned', true )
36 36
 			? 'pinned '
37 37
 			: '';
38
-		return glsr( Builder::class )->i([
38
+		return glsr( Builder::class )->i( [
39 39
 			'class' => $pinned.'dashicons dashicons-sticky',
40 40
 			'data-id' => $postId,
41
-		]);
41
+		] );
42 42
 	}
43 43
 
44 44
 	/**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function buildColumnReviewer( $postId )
49 49
 	{
50
-		return strval( get_post_meta( $postId, 'author', true ));
50
+		return strval( get_post_meta( $postId, 'author', true ) );
51 51
 	}
52 52
 
53 53
 	/**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function buildColumnRating( $postId )
59 59
 	{
60
-		return glsr_star_rating( intval( get_post_meta( $postId, 'rating', true )));
60
+		return glsr_star_rating( intval( get_post_meta( $postId, 'rating', true ) ) );
61 61
 	}
62 62
 
63 63
 	/**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	public function renderFilters( $postType )
80 80
 	{
81 81
 		if( $postType !== Application::POST_TYPE )return;
82
-		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
82
+		if( !($status = filter_input( INPUT_GET, 'post_status' )) ) {
83 83
 			$status = 'publish';
84 84
 		}
85 85
 		$ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status );
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	protected function renderFilterRatings( $ratings )
110 110
 	{
111
-		if( empty( $ratings ))return;
112
-		$ratings = array_flip( array_reverse( $ratings ));
111
+		if( empty($ratings) )return;
112
+		$ratings = array_flip( array_reverse( $ratings ) );
113 113
 		array_walk( $ratings, function( &$value, $key ) {
114 114
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
115 115
 			$value = sprintf( $label, $key );
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
 		echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [
118 118
 			'class' => 'screen-reader-text',
119 119
 			'for' => 'rating',
120
-		]);
121
-		echo glsr( Builder::class )->select([
120
+		] );
121
+		echo glsr( Builder::class )->select( [
122 122
 			'name' => 'rating',
123 123
 			'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings,
124 124
 			'value' => filter_input( INPUT_GET, 'rating' ),
125
-		]);
125
+		] );
126 126
 	}
127 127
 
128 128
 	/**
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 		echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
136 136
 			'class' => 'screen-reader-text',
137 137
 			'for' => 'review_type',
138
-		]);
139
-		echo glsr( Builder::class )->select([
138
+		] );
139
+		echo glsr( Builder::class )->select( [
140 140
 			'name' => 'review_type',
141 141
 			'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes,
142 142
 			'value' => filter_input( INPUT_GET, 'review_type' ),
143
-		]);
143
+		] );
144 144
 	}
145 145
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,7 +78,9 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function renderFilters( $postType )
80 80
 	{
81
-		if( $postType !== Application::POST_TYPE )return;
81
+		if( $postType !== Application::POST_TYPE ) {
82
+			return;
83
+		}
82 84
 		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
83 85
 			$status = 'publish';
84 86
 		}
@@ -107,7 +109,9 @@  discard block
 block discarded – undo
107 109
 	 */
108 110
 	protected function renderFilterRatings( $ratings )
109 111
 	{
110
-		if( empty( $ratings ))return;
112
+		if( empty( $ratings )) {
113
+			return;
114
+		}
111 115
 		$ratings = array_flip( array_reverse( $ratings ));
112 116
 		array_walk( $ratings, function( &$value, $key ) {
113 117
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
@@ -130,7 +134,9 @@  discard block
 block discarded – undo
130 134
 	 */
131 135
 	protected function renderFilterTypes( $types )
132 136
 	{
133
-		if( count( glsr()->reviewTypes ) < 2 )return;
137
+		if( count( glsr()->reviewTypes ) < 2 ) {
138
+			return;
139
+		}
134 140
 		echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
135 141
 			'class' => 'screen-reader-text',
136 142
 			'for' => 'review_type',
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsPopup.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
 	public function fields()
14 14
 	{
15 15
 		return [[
16
-			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )),
16
+			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
17 17
 			'minWidth' => 320,
18 18
 			'type' => 'container',
19
-		],[
19
+		], [
20 20
 			'label' => esc_html__( 'Title', 'site-reviews' ),
21 21
 			'name' => 'title',
22 22
 			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
23 23
 			'type' => 'textbox',
24
-		],[
24
+		], [
25 25
 			'label' => esc_html__( 'Count', 'site-reviews' ),
26 26
 			'maxLength' => 5,
27 27
 			'name' => 'count',
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 			'text' => '10',
30 30
 			'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ),
31 31
 			'type' => 'textbox',
32
-		],[
32
+		], [
33 33
 			'label' => esc_html__( 'Rating', 'site-reviews' ),
34 34
 			'name' => 'rating',
35 35
 			'options' => [
36
-				'5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 )),
37
-				'4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 )),
38
-				'3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 )),
39
-				'2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 )),
40
-				'1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 )),
41
-				'0' => esc_html( __( 'Unrated', 'site-reviews' )),
36
+				'5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ),
37
+				'4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ),
38
+				'3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ),
39
+				'2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ),
40
+				'1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ),
41
+				'0' => esc_html( __( 'Unrated', 'site-reviews' ) ),
42 42
 			],
43 43
 			'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ),
44 44
 			'type' => 'listbox',
45
-		],[
45
+		], [
46 46
 			'label' => esc_html__( 'Pagination', 'site-reviews' ),
47 47
 			'name' => 'pagination',
48 48
 			'options' => [
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 			'tooltip' => __( 'When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews' ),
54 54
 			'type' => 'listbox',
55 55
 		],
56
-		$this->getTypes( __( 'Which type of review would you like to display?', 'site-reviews' )),
57
-		$this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' )),
56
+		$this->getTypes( __( 'Which type of review would you like to display?', 'site-reviews' ) ),
57
+		$this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' ) ),
58 58
 		[
59 59
 			'label' => esc_html__( 'Assigned To', 'site-reviews' ),
60 60
 			'name' => 'assigned_to',
61 61
 			'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews' ),
62 62
 			'type' => 'textbox',
63
-		],[
63
+		], [
64 64
 			'label' => esc_html__( 'Schema', 'site-reviews' ),
65 65
 			'name' => 'schema',
66 66
 			'options' => [
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 			],
70 70
 			'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
71 71
 			'type' => 'listbox',
72
-		],[
72
+		], [
73 73
 			'label' => esc_html__( 'Classes', 'site-reviews' ),
74 74
 			'name' => 'class',
75 75
 			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
76 76
 			'type' => 'textbox',
77
-		],[
77
+		], [
78 78
 			'columns' => 2,
79 79
 			'items' => $this->getHideOptions(),
80 80
 			'label' => esc_html__( 'Hide', 'site-reviews' ),
81 81
 			'layout' => 'grid',
82 82
 			'spacing' => 5,
83 83
 			'type' => 'container',
84
-		],[
84
+		], [
85 85
 			'hidden' => true,
86 86
 			'name' => 'id',
87 87
 			'type' => 'textbox',
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsSummaryPopup.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,23 +12,23 @@  discard block
 block discarded – undo
12 12
 	public function fields()
13 13
 	{
14 14
 		return [[
15
-			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )),
15
+			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
16 16
 			'minWidth' => 320,
17 17
 			'type' => 'container',
18
-		],[
18
+		], [
19 19
 			'label' => esc_html__( 'Title', 'site-reviews' ),
20 20
 			'name' => 'title',
21 21
 			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
22 22
 			'type' => 'textbox',
23 23
 		],
24
-		$this->getTypes( __( 'Which type of review would you like to use?', 'site-reviews' )),
25
-		$this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' )),
24
+		$this->getTypes( __( 'Which type of review would you like to use?', 'site-reviews' ) ),
25
+		$this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' ) ),
26 26
 		[
27 27
 			'label' => esc_html__( 'Assigned To', 'site-reviews' ),
28 28
 			'name' => 'assigned_to',
29 29
 			'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews' ),
30 30
 			'type' => 'textbox',
31
-		],[
31
+		], [
32 32
 			'label' => esc_html__( 'Schema', 'site-reviews' ),
33 33
 			'name' => 'schema',
34 34
 			'options' => [
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 			],
38 38
 			'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
39 39
 			'type' => 'listbox',
40
-		],[
40
+		], [
41 41
 			'label' => esc_html__( 'Classes', 'site-reviews' ),
42 42
 			'name' => 'class',
43 43
 			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
44 44
 			'type' => 'textbox',
45
-		],[
45
+		], [
46 46
 			'columns' => 2,
47 47
 			'items' => $this->getHideOptions(),
48 48
 			'label' => esc_html__( 'Hide', 'site-reviews' ),
Please login to merge, or discard this patch.