Passed
Push — master ( 648c0b...8eca98 )
by Paul
09:10
created
plugin/Database.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 		if( empty( $assignedTo )) {
24 24
 			$assignedTo = get_post_meta( $postId, 'assigned_to', true );
25 25
 		}
26
-		if( empty( $assignedTo ))return;
26
+		if( empty( $assignedTo )) {
27
+			return;
28
+		}
27 29
 		$assignedPost = get_post( $assignedTo );
28 30
 		if( $assignedPost instanceof WP_Post && $assignedPost->ID != $postId ) {
29 31
 			return $assignedPost;
@@ -80,7 +82,9 @@  discard block
 block discarded – undo
80 82
 		$termIds = [];
81 83
 		foreach( $values as $value ) {
82 84
 			$term = get_term_by( $field, $value, Application::TAXONOMY );
83
-			if( !isset( $term->term_id ))continue;
85
+			if( !isset( $term->term_id )) {
86
+				continue;
87
+			}
84 88
 			$termIds[] = $term->term_id;
85 89
 		}
86 90
 		return $termIds;
@@ -127,7 +131,9 @@  discard block
 block discarded – undo
127 131
 		add_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2 );
128 132
 		$search = new WP_Query( $args );
129 133
 		remove_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500 );
130
-		if( !$search->have_posts() )return;
134
+		if( !$search->have_posts() ) {
135
+			return;
136
+		}
131 137
 		$results = '';
132 138
 		while( $search->have_posts() ) {
133 139
 			$search->the_post();
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsSummaryShortcode.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,8 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsSummaryShortcode extends Shortcode
8 8
 {
9
-	protected function hideOptions() {
9
+	protected function hideOptions()
10
+	{
10 11
 		return [
11 12
 			'rating' => __( 'Hide the rating', 'site-reviews' ),
12 13
 			'stars' => __( 'Hide the stars', 'site-reviews' ),
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsShortcode.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,8 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsShortcode extends Shortcode
8 8
 {
9
-	protected function hideOptions() {
9
+	protected function hideOptions()
10
+	{
10 11
 		return [
11 12
 			'title' => __( 'Hide the title', 'site-reviews' ),
12 13
 			'rating' => __( 'Hide the rating', 'site-reviews' ),
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsFormShortcode.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,8 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsFormShortcode extends Shortcode
8 8
 {
9
-	protected function hideOptions() {
9
+	protected function hideOptions()
10
+	{
10 11
 		return [
11 12
 			'rating' => __( 'Hide the rating field', 'site-reviews' ),
12 13
 			'title' => __( 'Hide the title field', 'site-reviews' ),
Please login to merge, or discard this patch.
plugin/Modules/Style.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@  discard block
 block discarded – undo
55 55
 		}
56 56
 		$views = $this->generatePossibleViews( $view );
57 57
 		foreach( $views as $possibleView ) {
58
-			if( !file_exists( glsr()->file( $possibleView )))continue;
58
+			if( !file_exists( glsr()->file( $possibleView ))) {
59
+				continue;
60
+			}
59 61
 			return glsr( Helper::class )->removePrefix( 'views/', $possibleView );
60 62
 		}
61 63
 		return $view;
@@ -88,7 +90,9 @@  discard block
 block discarded – undo
88 90
 	 */
89 91
 	public function modifyField( Builder $instance )
90 92
 	{
91
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return;
93
+		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields ))) {
94
+			return;
95
+		}
92 96
 		call_user_func_array( [$this, 'customize'], [&$instance] );
93 97
 	}
94 98
 
Please login to merge, or discard this patch.
plugin/Modules/Session.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -150,7 +150,9 @@  discard block
 block discarded – undo
150 150
 		if( !empty( $sessions )) {
151 151
 			$now = time();
152 152
 			foreach( $sessions as $session ) {
153
-				if( $now <= $session->expiration )continue;
153
+				if( $now <= $session->expiration ) {
154
+					continue;
155
+				}
154 156
 				$expiredSessions[] = $session->name;
155 157
 				$expiredSessions[] = str_replace( '_expires_', '_', $session->name );
156 158
 			}
@@ -193,7 +195,9 @@  discard block
 block discarded – undo
193 195
 	 */
194 196
 	protected function setCookie()
195 197
 	{
196
-		if( headers_sent() )return;
198
+		if( headers_sent() ) {
199
+			return;
200
+		}
197 201
 		$cookie = $this->sessionId.static::DELIMITER.$this->expiryTimestamp.static::DELIMITER.$this->expiryTimestampReset;
198 202
 		$cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' )));
199 203
 		setcookie( static::SESSION_COOKIE, $cookie, $this->expiryTimestamp, $cookiePath );
Please login to merge, or discard this patch.
plugin/Modules/Notification.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function send( Review $review )
45 45
 	{
46
-		if( empty( $this->types ))return;
46
+		if( empty( $this->types )) {
47
+			return;
48
+		}
47 49
 		$this->review = $review;
48 50
 		$args = [
49 51
 			'link' => $this->getLink(),
@@ -146,7 +148,9 @@  discard block
 block discarded – undo
146 148
 	protected function sendToEmail( array $args )
147 149
 	{
148 150
 		$email = $this->buildEmail( $args );
149
-		if( !$this->email )return;
151
+		if( !$this->email ) {
152
+			return;
153
+		}
150 154
 		if( empty( $email->to )) {
151 155
 			glsr_log()->error( 'Email notification was not sent (missing email address)' );
152 156
 			return;
@@ -161,7 +165,9 @@  discard block
 block discarded – undo
161 165
 	 */
162 166
 	protected function sendToSlack( array $args )
163 167
 	{
164
-		if( !$this->slack )return;
168
+		if( !$this->slack ) {
169
+			return;
170
+		}
165 171
 		$notification = $this->buildSlackNotification( $args );
166 172
 		$result = $notification->send();
167 173
 		if( is_wp_error( $result )) {
Please login to merge, or discard this patch.
plugin/Modules/Validator/ValidateReview.php 1 patch
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.
plugin/Controllers/EditorController.php 1 patch
Braces   +33 added lines, -11 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@  discard block
 block discarded – undo
91 91
 	{
92 92
 		add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' );
93 93
 		add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' );
94
-		if( get_post_meta( $post->ID, 'review_type', true ) != 'local' )return;
94
+		if( get_post_meta( $post->ID, 'review_type', true ) != 'local' ) {
95
+			return;
96
+		}
95 97
 		add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' );
96 98
 	}
97 99
 
@@ -127,7 +129,9 @@  discard block
 block discarded – undo
127 129
 	 */
128 130
 	public function renderAssignedToMetabox( WP_Post $post )
129 131
 	{
130
-		if( !$this->isReviewPostType( $post ))return;
132
+		if( !$this->isReviewPostType( $post )) {
133
+			return;
134
+		}
131 135
 		$assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true );
132 136
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
133 137
 		glsr()->render( 'partials/editor/metabox-assigned-to', [
@@ -142,7 +146,9 @@  discard block
 block discarded – undo
142 146
 	 */
143 147
 	public function renderDetailsMetaBox( WP_Post $post )
144 148
 	{
145
-		if( !$this->isReviewPostType( $post ))return;
149
+		if( !$this->isReviewPostType( $post )) {
150
+			return;
151
+		}
146 152
 		$review = glsr( ReviewManager::class )->single( $post );
147 153
 		glsr()->render( 'partials/editor/metabox-details', [
148 154
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
@@ -156,7 +162,9 @@  discard block
 block discarded – undo
156 162
 	 */
157 163
 	public function renderPinnedInPublishMetaBox()
158 164
 	{
159
-		if( !$this->isReviewPostType( get_post() ))return;
165
+		if( !$this->isReviewPostType( get_post() )) {
166
+			return;
167
+		}
160 168
 		glsr( Template::class )->render( 'partials/editor/pinned', [
161 169
 			'context' => [
162 170
 				'no' => __( 'No', 'site-reviews' ),
@@ -172,7 +180,9 @@  discard block
 block discarded – undo
172 180
 	 */
173 181
 	public function renderResponseMetaBox( WP_Post $post )
174 182
 	{
175
-		if( !$this->isReviewPostType( $post ))return;
183
+		if( !$this->isReviewPostType( $post )) {
184
+			return;
185
+		}
176 186
 		wp_nonce_field( 'response', '_nonce-response', false );
177 187
 		glsr()->render( 'partials/editor/metabox-response', [
178 188
 			'response' => get_post_meta( $post->ID, 'response', true ),
@@ -185,7 +195,9 @@  discard block
 block discarded – undo
185 195
 	 */
186 196
 	public function renderReviewEditor( WP_Post $post )
187 197
 	{
188
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
198
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
199
+			return;
200
+		}
189 201
 		glsr()->render( 'partials/editor/review', [
190 202
 			'post' => $post,
191 203
 			'response' => get_post_meta( $post->ID, 'response', true ),
@@ -199,7 +211,9 @@  discard block
 block discarded – undo
199 211
 	public function renderReviewFields()
200 212
 	{
201 213
 		$screen = glsr_current_screen();
202
-		if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE )return;
214
+		if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE ) {
215
+			return;
216
+		}
203 217
 		add_action( 'edit_form_after_title', [$this, 'renderReviewEditor'] );
204 218
 		add_action( 'edit_form_top',         [$this, 'renderReviewNotice'] );
205 219
 	}
@@ -210,7 +224,9 @@  discard block
 block discarded – undo
210 224
 	 */
211 225
 	public function renderReviewNotice( WP_Post $post )
212 226
 	{
213
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
227
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
228
+			return;
229
+		}
214 230
 		glsr( Notice::class )->addWarning( sprintf(
215 231
 			__( '%s reviews are read-only.', 'site-reviews' ),
216 232
 			glsr( Columns::class )->buildColumnReviewType( $post->ID )
@@ -229,7 +245,9 @@  discard block
 block discarded – undo
229 245
 	 */
230 246
 	public function renderTaxonomyMetabox( WP_Post $post )
231 247
 	{
232
-		if( !$this->isReviewPostType( $post ))return;
248
+		if( !$this->isReviewPostType( $post )) {
249
+			return;
250
+		}
233 251
 		glsr()->render( 'partials/editor/metabox-categories', [
234 252
 			'post' => $post,
235 253
 			'tax_name' => Application::TAXONOMY,
@@ -267,7 +285,9 @@  discard block
 block discarded – undo
267 285
 	protected function buildAssignedToTemplate( $assignedTo, WP_Post $post )
268 286
 	{
269 287
 		$assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo );
270
-		if( !( $assignedPost instanceof WP_Post ))return;
288
+		if( !( $assignedPost instanceof WP_Post )) {
289
+			return;
290
+		}
271 291
 		return glsr( Template::class )->build( 'partials/editor/assigned-post', [
272 292
 			'context' => [
273 293
 				'data.url' => (string)get_permalink( $assignedPost ),
@@ -312,7 +332,9 @@  discard block
 block discarded – undo
312 332
 	 */
313 333
 	protected function getReviewType( $review )
314 334
 	{
315
-		if( count( glsr()->reviewTypes ) < 2 )return;
335
+		if( count( glsr()->reviewTypes ) < 2 ) {
336
+			return;
337
+		}
316 338
 		$reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes )
317 339
 			? glsr()->reviewTypes[$review->review_type]
318 340
 			: __( 'Unknown', 'site-reviews' );
Please login to merge, or discard this patch.